forked from mongodb/stitch-js-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix StitchError stack traces in node
* Add `babel-plugin-transform-builtin-extend` * Subclassing builtin types needs special treatment by babel * Without this plugin, in a node environment, a subclass of Error does not actually behave like a true subclass, which manifests itself via a missing stacktrace when a StitchError is thrown More details [here](babel/babel#3083)
- Loading branch information
1 parent
4841bf0
commit 98a85a9
Showing
3 changed files
with
13 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { StitchError } from '../src/errors'; | ||
|
||
describe('StitchError', () => { | ||
it('reports a full stack trace', () => { | ||
const err = new StitchError("Oh noes!"); | ||
expect(err.toString()).toEqual('StitchError: Oh noes!'); | ||
expect(err.stack.length).toBeGreaterThan(err.toString().length); | ||
}); | ||
}); |