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 of the ErrorHandlerService is done entirely in your app.module.ts file.

Import ErrorHandler from @angular/core as well as ErrorHandlerService from @precisionhealth/clinical-office-mpage.

import {ErrorHandler} from '@angular/core'
import {ErrorHandlerService} from '@precisionhealth/clinical-office-mpage'

In the providers section of your @NgModule, set the ErrorHandlerService as the new ErrorHandler

    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.