feat(debug): add IonicErrorHandler

This commit is contained in:
Max Lynch
2016-10-19 16:23:15 -05:00
parent c66a440974
commit 9397d6b53a
2 changed files with 15 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ export * from './gestures/gesture-controller';
export * from './util/click-block';
export * from './util/events';
export * from './util/haptic';
export * from './util/ionic-error-handler';
export * from './util/keyboard';
export * from './util/form';
export { reorderArray } from './util/util';

View File

@@ -0,0 +1,14 @@
/**
* This class is an internal error handler for Ionic. We can often add
* some nice goodies to the dev/debugging process by reporting to our
* dev server. To use this class, call `IonicErrorHandler.handleError(err)` from
* inside a custom `ErrorHandler` as described here: https://angular.io/docs/ts/latest/api/core/index/ErrorHandler-class.html
*/
export class IonicErrorHandler {
static handleError(err: any) : void {
let server = window['IonicDevServer'];
if (server) {
server.handleError(err);
}
}
}