I want when any one of EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError is thrown through my code I want to these error should thrown after an ajex request so that I can get to know analyse the client error logs.
When I went deep, I found that sevral interface are created for these error by extending Error class e.g.
interface TypeError extends Error {
}
interface TypeErrorConstructor {
new (message?: string): TypeError;
(message?: string): TypeError;
prototype: TypeError;
}
declare var TypeError: TypeErrorConstructor;
interface Error {
name: string;
message: string;
}
interface ErrorConstructor {
new (message?: string): Error;
(message?: string): Error;
prototype: Error;
}
declare var Error: ErrorConstructor;
So is there any way to redefine/update these interface defination so before throwing these error it should make an ajex request to the server.
Note: I dont want to use windows.onerror since some other library(rollbar) has own onerror implimentation.
Is it possible to redefine these interface. e.g. I can redefine console.log as follows:
console.log=function(){
return arguments;
}