diff --git a/cvat-ui/package-lock.json b/cvat-ui/package-lock.json index e2ac4ffd3fe..5ca22abcaec 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.8.2", + "version": "1.8.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-ui/package.json b/cvat-ui/package.json index d9c0229dba9..c2705de84fb 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.8.2", + "version": "1.8.3", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": { diff --git a/cvat-ui/src/index.tsx b/cvat-ui/src/index.tsx index cfb1605d9cc..f1f7f7f17e2 100644 --- a/cvat-ui/src/index.tsx +++ b/cvat-ui/src/index.tsx @@ -144,20 +144,17 @@ ReactDOM.render( document.getElementById('root'), ); -window.onerror = ( - message: Event | string, - source?: string, - lineno?: number, - colno?: number, - error?: Error, -) => { - if (typeof (message) === 'string' && source && typeof (lineno) === 'number' && (typeof (colno) === 'number') && error) { +window.addEventListener('error', (errorEvent: ErrorEvent) => { + if (errorEvent.filename + && typeof (errorEvent.lineno) === 'number' + && typeof (errorEvent.colno) === 'number' + && errorEvent.error) { const logPayload = { - filename: source, - line: lineno, - message: error.message, - column: colno, - stack: error.stack, + filename: errorEvent.filename, + line: errorEvent.lineno, + message: errorEvent.error.message, + column: errorEvent.colno, + stack: errorEvent.error.stack, }; const store = getCVATStore(); @@ -171,4 +168,4 @@ window.onerror = ( logger.log(LogType.sendException, logPayload); } } -}; +});