fix(exception_handler): log errors via console.error
This is e.g. needed as we use this to test for errors in our examples.
This commit is contained in:
@ -2,8 +2,15 @@
|
||||
<html>
|
||||
<title>Sourcemaps</title>
|
||||
<body>
|
||||
<error-app>
|
||||
Loading...
|
||||
</error-app>
|
||||
|
||||
<p>
|
||||
Please look into the console and check whether the stack trace is mapped
|
||||
via source maps!
|
||||
</p>
|
||||
|
||||
$SCRIPTS$
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,24 +1,24 @@
|
||||
import { BaseException, print, CONST } from 'angular2/src/facade/lang';
|
||||
import { bootstrap } from 'angular2/angular2';
|
||||
// TODO(radokirov): Once the application is transpiled by TS instead of Traceur,
|
||||
// add those imports back into 'angular2/angular2';
|
||||
import {Component} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
|
||||
class TestAnnotation {
|
||||
@CONST()
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
// Use a class with an annotation,
|
||||
// as this is where we expect the most source code changes
|
||||
// through compilation.
|
||||
@TestAnnotation()
|
||||
class Test {
|
||||
run() {
|
||||
try {
|
||||
throw new BaseException('Sourcemap test');
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
@Component({
|
||||
selector: 'error-app',
|
||||
})
|
||||
@View({
|
||||
template: `
|
||||
<button class="errorButton" (click)="createError()">create error</button>`,
|
||||
directives: []
|
||||
})
|
||||
export class ErrorComponent {
|
||||
createError() {
|
||||
throw new BaseException('Sourcemap test');
|
||||
}
|
||||
}
|
||||
|
||||
export function main() {
|
||||
new Test().run();
|
||||
bootstrap(ErrorComponent);
|
||||
}
|
||||
|
Reference in New Issue
Block a user