UNPKG

2.5 kBJavaScriptView Raw
1var __extends = (this && this.__extends) || (function () {
2 var extendStatics = Object.setPrototypeOf ||
3 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
4 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
5 return function (d, b) {
6 extendStatics(d, b);
7 function __() { this.constructor = d; }
8 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
9 };
10})();
11import { ErrorHandler } from '@angular/core';
12/**
13 * \@name IonicErrorHandler
14 * \@description
15 * The `IonicErrorHandler` intercepts the default `Console` error handling
16 * and displays runtime errors as an overlay when using Ionic's Dev Build Server.
17 *
18 *
19 * ### IonicErrorHandler Example
20 *
21 * ```typescript
22 * import { ErrorHandler, NgModule } from '\@angular/core';
23 * import { IonicErrorHandler } from 'ionic-angular';
24 *
25 * \@NgModule({
26 * providers: [{ provide: ErrorHandler, useClass: IonicErrorHandler }]
27 * })
28 * class AppModule { }
29 * ```
30 *
31 *
32 * ### Custom Error Handlers
33 *
34 * Custom error handlers can be built to replace the default, or extend Ionic's
35 * error handler.
36 *
37 * ```typescript
38 * class MyErrorHandler implements ErrorHandler {
39 * handleError(err: any): void {
40 * // do something with the error
41 * }
42 * }
43 *
44 * \@NgModule({
45 * providers: [{ provide: ErrorHandler, useClass: MyErrorHandler }]
46 * })
47 * class AppModule { }
48 * ```
49 *
50 * More information about Angular's [`ErrorHandler`](https://angular.io/docs/ts/latest/api/core/index/ErrorHandler-class.html).
51 */
52var IonicErrorHandler = (function (_super) {
53 __extends(IonicErrorHandler, _super);
54 function IonicErrorHandler() {
55 return _super.call(this, false) || this;
56 }
57 /**
58 * \@internal
59 * @param {?} err
60 * @return {?}
61 */
62 IonicErrorHandler.prototype.handleError = function (err) {
63 _super.prototype.handleError.call(this, err);
64 try {
65 var /** @type {?} */ win = window;
66 var /** @type {?} */ monitor = void 0;
67 monitor = win['IonicDevServer'];
68 monitor && monitor.handleError && monitor.handleError(err);
69 monitor = (win['Ionic'] = win['Ionic'] || {}).Monitor;
70 monitor && monitor.handleError && monitor.handleError(err);
71 }
72 catch (e) { }
73 };
74 return IonicErrorHandler;
75}(ErrorHandler));
76export { IonicErrorHandler };
77//# sourceMappingURL=ionic-error-handler.js.map
\No newline at end of file