From ff9ff4a3771689c56d557bf0dbeeb46a50d1adf2 Mon Sep 17 00:00:00 2001 From: Aaron O'Mullan Date: Thu, 22 Apr 2021 02:50:50 +0200 Subject: refactor(core): simplify error handling (#10297) - register builtin v8 errors in core.js so consumers don't have to - remove complexity of error args handling (consumers must provide a constructor with custom args, core simply provides msg arg) --- runtime/js/99_main.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'runtime/js') diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js index 7742e2ba2..851d798c3 100644 --- a/runtime/js/99_main.js +++ b/runtime/js/99_main.js @@ -186,16 +186,11 @@ delete Object.prototype.__proto__; core.registerErrorClass("Http", errors.Http); core.registerErrorClass("Busy", errors.Busy); core.registerErrorClass("NotSupported", errors.NotSupported); - core.registerErrorClass("Error", Error); - core.registerErrorClass("RangeError", RangeError); - core.registerErrorClass("ReferenceError", ReferenceError); - core.registerErrorClass("SyntaxError", SyntaxError); - core.registerErrorClass("TypeError", TypeError); - core.registerErrorClass("URIError", URIError); core.registerErrorClass( "DOMExceptionOperationError", - DOMException, - "OperationError", + function DOMExceptionOperationError(msg) { + DOMException.prototype.constructor.call(this, msg, "OperationError"); + }, ); } -- cgit v1.2.3