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:
Tobias Bosch
2015-04-30 11:25:50 -07:00
parent 87dcd5eb6f
commit ead21c91a4
10 changed files with 52 additions and 20 deletions

View File

@ -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>

View File

@ -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);
}