-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(UnsubscriptionError): add messages from inner errors to output m…
…essage - Adds improved console logging behavior closes #1590
- Loading branch information
Showing
2 changed files
with
31 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import {expect} from 'chai'; | ||
import * as Rx from '../../dist/cjs/Rx'; | ||
|
||
const { Observable, UnsubscriptionError } = Rx; | ||
|
||
/** @test {UnsubscriptionError} */ | ||
describe('UnsubscriptionError', () => { | ||
it('should create a message that is a clear indication of its internal errors', () => { | ||
const err1 = new Error('Swiss cheese tastes amazing but smells like socks'); | ||
const err2 = new Error('User too big to fit in tiny European elevator'); | ||
const source1 = Observable.create(() => () => { throw err1; }); | ||
const source2 = Observable.timer(1000); | ||
const source3 = Observable.create(() => () => { throw err2; }); | ||
const source = source1.merge(source2, source3); | ||
|
||
const subscription = source.subscribe(); | ||
|
||
try { | ||
subscription.unsubscribe(); | ||
} catch (err) { | ||
expect(err instanceof UnsubscriptionError).to.equal(true); | ||
expect(err.message).to.equal(`2 errors occurred during unsubscription: | ||
1) ${err1} | ||
2) ${err2}`); | ||
expect(err.name).to.equal('UnsubscriptionError'); | ||
} | ||
}); | ||
}); |
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