Skip to content

Commit d47f0cf

Browse files
committed
add sream error event handler
1 parent 42673ce commit d47f0cf

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/renderer/renderer.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ class Renderer extends EventEmitter implements IRenderer {
141141
const isPure = options && options.pure;
142142
return this.getComponent(path, context).then((component) => {
143143
const bodyStream = this.vueRenderer.renderToStream(component);
144+
bodyStream.on('error', (e) => {
145+
e.component = path;
146+
this.emit('error', e);
147+
});
144148

145149
if (isPure) return bodyStream;
146150

@@ -158,9 +162,10 @@ class Renderer extends EventEmitter implements IRenderer {
158162
};
159163
const isPure = options && options.pure;
160164
return this.getComponent(path, context).then(component => new Promise((resolve, reject) => {
161-
this.vueRenderer.renderToString(component, (err, result) => {
162-
if (err) {
163-
reject(err);
165+
this.vueRenderer.renderToString(component, (e, result) => {
166+
if (e) {
167+
e.component = path;
168+
reject(e);
164169
return;
165170
}
166171
if (isPure) {

0 commit comments

Comments
 (0)