bahmutov / lazy-ass

Lazy node assertions without performance penalty
http://glebbahmutov.com/lazy-ass/
MIT License
68 stars 5 forks source link

Rethrow an error object #19

Closed bahmutov closed 8 years ago

bahmutov commented 8 years ago

If passed an error object, just rethrow it for example

promise.then(fn, la)
// promise resolves with value -> no error
// promise rejected with Error instance -> throw the instance
bahmutov commented 8 years ago

will make testing Observables really simple

observable.subscribe(onEvent, la, onCompleted)
// instead of
observable.subscribe(onEvent, err => { throw err }, onCompleted)