diff --git a/src/index.ts b/src/index.ts index be81af4023..1b9e26aff6 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 0000000000..6db0b3564b --- /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); + } + } +}