Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/rpc-worker-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ function workerSetup() {
.catch(e => {
let error = { message: e };
if (e.stack) {
error = Object.assign({}, e);

/* Include potentially nonenumerable values */
error.message = e.message;
error.stack = e.stack;
error.name = e.name;
Expand Down
1 change: 1 addition & 0 deletions test/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe('worker', () => {
}
catch (e) {
expect(e).toEqual(Error('Error in worker.js'));
expect(e.foo).toEqual('bar');
}
});

Expand Down
4 changes: 3 additions & 1 deletion test/src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ export function foo() {
}

export function throwError() {
throw new Error('Error in worker.js');
const toThrow = new Error('Error in worker.js');
toThrow.foo = 'bar';
throw toThrow;
}

export const bar = (a, b) => `${a} [bar:${otherBar}] ${b}`;