ErrorHandlerService
The ErrorHandlerService has been developed as a solution to the lack of F12 developer tool availability within an MPage. When implemented into your Angular application, any runtime errors are handled by the ErrorHandlerService.
If you initialized your MPage service with logging enabled, any errors will be captured in the MPage service log which can be easily viewed with the MPage Log Component.
If you do not have logging enabled in your MPage, runtime errors will be presented as a pop-up window as they occur.
Implementation
The clinicaloffice/ie-mpage or clinicaloffice/edge-mpage GitHub template projects have the ErrorHandler service pre-configured and enabled with the activity log component. No changes in your project are necessary however this documentation can be used to get a better understanding of the ErrorHandler service and also indicates where changes should be made if you decide to disable the ErrorHandler Service.
Implementation of the ErrorHandlerService is done entirely in your app.module.ts file.
Import ErrorHandler from @angular/core as well as ErrorHandlerService from @clinicaloffice/clinical-office-mpage.
import {ErrorHandler} from '@angular/core' V4+ import { ErrorHandlerService } from '@clinicaloffice/clinical-office-mpage-core'; < V3 import { ErrorHandlerService } from '@clinicaloffice/clinical-office-mpage';
In the providers section of your @NgModule, set the ErrorHandlerService as the new ErrorHandler
@NgModule({
declarations: [...],
imports: [...],
providers: [
{provide: ErrorHandler, useClass: ErrorHandlerService}
],
bootstrap: [...]
})
export class AppModule {
}
As runtime errors occur in your MPage, they will either be displayed in the Activity Log or if logging is turned off they will be displayed on screen as an alert.