UNPKG

@qooxdoo/framework

Version:

The JS Framework for Coders

89 lines (73 loc) 2 kB
/* ************************************************************************ qooxdoo - the new era of web development http://qooxdoo.org Copyright: 2007-2008 1&1 Internet AG, Germany, http://www.1und1.de License: MIT: https://opensource.org/licenses/MIT See the LICENSE file in the project's top-level directory for details. Authors: * Michael Haitz (mhaitz) ************************************************************************ */ /** * This exception is thrown by the {@link qx.event.GlobalError} handler if a * observed method throws an exception. */ qx.Bootstrap.define("qx.core.GlobalError", { extend: Error, /** * @param exc {Error} source exception * @param args {Array} arguments */ construct(exc, args) { // Do not use the Environment class to keep the minimal // package size small [BUG #5068] if (qx.Bootstrap.DEBUG) { qx.core.Assert.assertNotUndefined(exc); } this.__failMessage = "GlobalError: " + (exc && exc.message ? exc.message : exc); var inst = Error.call(this, this.__failMessage); // map stack trace properties since they're not added by Error's constructor if (exc && exc.stack) { this.stack = exc.stack; } if (!this.stack && inst.stack) { this.stack = inst.stack; } if (inst.stacktrace) { this.stacktrace = inst.stacktrace; } this.__arguments = args; this.__exc = exc; }, members: { __exc: null, __arguments: null, __failMessage: null, /** * Returns the error message. * * @return {String} error message */ toString() { return this.__failMessage; }, /** * Returns the arguments which are * * @return {Object} arguments */ getArguments() { return this.__arguments; }, /** * Get the source exception * * @return {Error} source exception */ getSourceException() { return this.__exc; } } });