Uncaught Error Event - NativeScript + Angular


#1

I’m trying to implement a Class that will treat errors displayed by the system and I have the following code

@Injectable()
export class ErrorHandlingService extends ErrorHandler{

    constructor(){
        super(false);
    }

    handleError(error: any): void {

        try{
            if(error instanceof Response){
                this.httpError(error);            
            }else{
                super.handleError(error);
            }
        }catch(e){
            console.log("Error: " + e);
        }     
    }
}

With this Class I can, till now, treat the response types errors and the Angular ones, however I also need to treat the ones generated by Android and IOS platforms. I implemented the code following this link http://docs.nativescript.org/core-concepts/application-lifecycle#use-application-events but I can’t make it work. In witch file do I need to implement this code or what do I need to do so this code starts working properly? I’m using NativeScript + Angular.