From 9397d6b53a81b0ea228d18f2f619dfe2d4040219 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Wed, 19 Oct 2016 16:23:15 -0500 Subject: [PATCH] feat(debug): add IonicErrorHandler --- src/index.ts | 1 + src/util/ionic-error-handler.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 src/util/ionic-error-handler.ts diff --git a/src/index.ts b/src/index.ts index be81af4023e..1b9e26aff6d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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'; diff --git a/src/util/ionic-error-handler.ts b/src/util/ionic-error-handler.ts new file mode 100644 index 00000000000..6db0b3564b8 --- /dev/null +++ b/src/util/ionic-error-handler.ts @@ -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); + } + } +}