PluginProbe
Force Refresh / 2.0.0
Force Refresh v2.0.0
3.2.1 3.2.0 3.1.2 3.1.1 3.1.0 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.2.0 2.0.0 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.10.0 2.10.1 2.10.2 2.11.0 2.11.1 2.12.0 All 54 releases
force-refresh / node_modules / handlebars / lib / handlebars / exception.js

exception.js in Force Refresh 2.0.0, at node_modules/handlebars/lib/handlebars/exception.js

50 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1
2 const errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
3
4 function Exception(message, node) {
5 let loc = node && node.loc,
6 line,
7 column;
8 if (loc) {
9 line = loc.start.line;
10 column = loc.start.column;
11
12 message += ' - ' + line + ':' + column;
13 }
14
15 let tmp = Error.prototype.constructor.call(this, message);
16
17 // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
18 for (let idx = 0; idx < errorProps.length; idx++) {
19 this[errorProps[idx]] = tmp[errorProps[idx]];
20 }
21
22 /* istanbul ignore else */
23 if (Error.captureStackTrace) {
24 Error.captureStackTrace(this, Exception);
25 }
26
27 try {
28 if (loc) {
29 this.lineNumber = line;
30
31 // Work around issue under safari where we can't directly set the column value
32 /* istanbul ignore next */
33 if (Object.defineProperty) {
34 Object.defineProperty(this, 'column', {
35 value: column,
36 enumerable: true
37 });
38 } else {
39 this.column = column;
40 }
41 }
42 } catch (nop) {
43 /* Ignore if the browser is very particular */
44 }
45 }
46
47 Exception.prototype = new Error();
48
49 export default Exception;
50