|
28 | 28 | #include "libembind_shared.js" |
29 | 29 |
|
30 | 30 | var LibraryEmbind = { |
31 | | - $UnboundTypeError__deps: ['$extendError'], |
32 | | - $UnboundTypeError: "=Module['UnboundTypeError'] = extendError(Error, 'UnboundTypeError')", |
33 | | - $PureVirtualError__deps: ['$extendError'], |
34 | | - $PureVirtualError: "=Module['PureVirtualError'] = extendError(Error, 'PureVirtualError')", |
| 31 | + $UnboundTypeError: class extends Error {}, |
| 32 | + $PureVirtualError: class extends Error {}, |
35 | 33 | $GenericWireTypeSize: {{{ 2 * POINTER_SIZE }}}, |
36 | 34 | #if EMBIND_AOT |
37 | 35 | $InvokerFunctions: '<<< EMBIND_AOT_OUTPUT >>>', |
@@ -148,32 +146,6 @@ var LibraryEmbind = { |
148 | 146 | } |
149 | 147 | }, |
150 | 148 |
|
151 | | - // from https://github.com/imvu/imvujs/blob/master/src/error.js |
152 | | - $extendError__deps: ['$createNamedFunction'], |
153 | | - $extendError: (baseErrorType, errorName) => { |
154 | | - var errorClass = createNamedFunction(errorName, function(message) { |
155 | | - this.name = errorName; |
156 | | - this.message = message; |
157 | | - |
158 | | - var stack = (new Error(message)).stack; |
159 | | - if (stack !== undefined) { |
160 | | - this.stack = this.toString() + '\n' + |
161 | | - stack.replace(/^Error(:[^\n]*)?\n/, ''); |
162 | | - } |
163 | | - }); |
164 | | - errorClass.prototype = Object.create(baseErrorType.prototype); |
165 | | - errorClass.prototype.constructor = errorClass; |
166 | | - errorClass.prototype.toString = function() { |
167 | | - if (this.message === undefined) { |
168 | | - return this.name; |
169 | | - } else { |
170 | | - return `${this.name}: ${this.message}`; |
171 | | - } |
172 | | - }; |
173 | | - |
174 | | - return errorClass; |
175 | | - }, |
176 | | - |
177 | 149 | $createNamedFunction: (name, func) => Object.defineProperty(func, 'name', { value: name }), |
178 | 150 |
|
179 | 151 | $embindRepr: (v) => { |
|
0 commit comments