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(BaseException): convert JS stack property to getter
The stack property of BaseException was previously being set in the constructor based on the provided message, but subclasses of BaseException would change the message after constructing the error. This change implements stack as a getter of BaseException, deferring the creation of the stack until it is asked for. Fixes angular#2570
- Loading branch information
1 parent
b2c6694
commit 16e83db
Showing
5 changed files
with
51 additions
and
4 deletions.
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
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,24 @@ | ||
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'); | ||
} | ||
}); | ||
}); | ||
} |
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