Skip to content

Commit 9397d6b

Browse files
committed
feat(debug): add IonicErrorHandler
1 parent c66a440 commit 9397d6b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export * from './gestures/gesture-controller';
1111
export * from './util/click-block';
1212
export * from './util/events';
1313
export * from './util/haptic';
14+
export * from './util/ionic-error-handler';
1415
export * from './util/keyboard';
1516
export * from './util/form';
1617
export { reorderArray } from './util/util';

src/util/ionic-error-handler.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* This class is an internal error handler for Ionic. We can often add
3+
* some nice goodies to the dev/debugging process by reporting to our
4+
* dev server. To use this class, call `IonicErrorHandler.handleError(err)` from
5+
* inside a custom `ErrorHandler` as described here: https://angular.io/docs/ts/latest/api/core/index/ErrorHandler-class.html
6+
*/
7+
export class IonicErrorHandler {
8+
static handleError(err: any) : void {
9+
let server = window['IonicDevServer'];
10+
if (server) {
11+
server.handleError(err);
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)