Similarly to ask made in this question, I am trying to push all unhandled errors to our telemetry pipeline in order to provide enough information for engineers to debug the problems.
The unhandled exception handler was set up in following way:
window.onerror = (event: Event | string, source?: string, lineno?: number, colno?: number, error?: Error) => {
const message: string = `src: ${source} line: ${lineno} col: ${colno}`;
logError(error || new Error(event.toString()), message);
};
This seems to be inline with documentation.
After telemetry started flowing I observed following:
- For majority of handler invocations
error
variable is null. lineno
andcolno
are also eithernull
or0
.
I am aware of CROSSORIGIN setting and it seems to be set up properly.
I wasn't able to find any strict rules that describe what info is provided during unhandled callback. I am also looking for feedbacks on the way we set up unhandled callback and ideas for potential improvements.