https://github.com/simplesmiler/assimilate-error
Assimilate error that originated from another execution context
https://github.com/simplesmiler/assimilate-error
Last synced: about 1 year ago
JSON representation
Assimilate error that originated from another execution context
- Host: GitHub
- URL: https://github.com/simplesmiler/assimilate-error
- Owner: simplesmiler
- License: isc
- Created: 2017-03-15T20:26:00.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-15T20:32:52.000Z (over 9 years ago)
- Last Synced: 2025-03-11T05:42:06.515Z (over 1 year ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# assimilate-error
> Assimilate error-like object, that originated from a different execution context, or was created in a weird way.
## Install
``` sh
$ npm install assimilate-error --save
```
## Usage
``` js
var errio = require('errio');
var assimilateError = require('assimilate-error');
var err1 = new Error('Demo');
var serialized1 = errio.toObject(err1, { stack: true });
var err2 = errio.fromObject(serialized1);
err2; // outputs `Error { ... }` in the Chrome console
err2 = assimilateError(err2, true);
err2; // outputs `Error: Demo` with the stack in Chrome console
```
## License
[ISC](https://opensource.org/licenses/ISC)