Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80724 views
1
define(
2
["exports"],
3
function(__exports__) {
4
"use strict";
5
6
var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
7
8
function Exception(message, node) {
9
var loc = node && node.loc,
10
line,
11
column;
12
if (loc) {
13
line = loc.start.line;
14
column = loc.start.column;
15
16
message += ' - ' + line + ':' + column;
17
}
18
19
var tmp = Error.prototype.constructor.call(this, message);
20
21
// Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
22
for (var idx = 0; idx < errorProps.length; idx++) {
23
this[errorProps[idx]] = tmp[errorProps[idx]];
24
}
25
26
if (loc) {
27
this.lineNumber = line;
28
this.column = column;
29
}
30
}
31
32
Exception.prototype = new Error();
33
34
__exports__["default"] = Exception;
35
});
36