forked from angular/angular
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(di/exceptions): initialize Error superclass with message
For subclasses of Error, initializing classes without providing a message to super() would cause any messages to be suppressed from logged errors. This fix provides an initial message to super(). Fixes angular#2570
- Loading branch information
1 parent
b2c6694
commit 58c38f9
Showing
3 changed files
with
27 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
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,3 @@ | ||
library angular2.test.di.exceptions_spec; | ||
// Not implemented | ||
main() {} |
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,23 @@ | ||
import { | ||
AsyncTestCompleter, | ||
beforeEach, | ||
ddescribe, | ||
describe, | ||
expect, | ||
iit, | ||
inject, | ||
it, | ||
xit, | ||
} from 'angular2/test_lib'; | ||
import {AbstractBindingError} from 'angular2/di'; | ||
|
||
export function main() { | ||
describe('exceptions', () => { | ||
it('should have the proper message when thrown', () => { | ||
try { | ||
throw new AbstractBindingError('foo', () => { return 'message'; }); | ||
} catch (e) { | ||
expect(e.stack.split('\n')[0]).toBe('Error: message'); | ||
} | ||
}); | ||
} |