Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stackable errors #3

Open
yanickrochon opened this issue Mar 15, 2015 · 0 comments
Open

Stackable errors #3

yanickrochon opened this issue Mar 15, 2015 · 0 comments

Comments

@yanickrochon
Copy link
Owner

Like message, and messageData are "special" properties, previousError should provide a way to stack errors for more detailed information. For example :

var CustomError1 = errorFactory('CustomError1');
var CustomError2 = errorFactory('CustomError2', [ 'message', 'previousError' ]);

var err = CustomError2("Example", CustomError1("Stacked error"));

console.log(err.stack);
// Error: Example
//    at ...
// Error: Stacked Error
//    at ...

Since the stacked error stack trace is invoked directly, this behaviour can be recursive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant