mirror of
https://github.com/10h30/odin-javascript-exercises.git
synced 2026-07-12 11:16:09 +09:00
Clean up the oopsie. Rebuild the blank exercises.
This commit is contained in:
+12
-4
@@ -51,20 +51,28 @@ var errorEx = function errorEx(name, properties) {
|
||||
}
|
||||
});
|
||||
|
||||
var overwrittenStack = null;
|
||||
|
||||
var stackDescriptor = Object.getOwnPropertyDescriptor(this, 'stack');
|
||||
var stackGetter = stackDescriptor.get;
|
||||
var stackValue = stackDescriptor.value;
|
||||
delete stackDescriptor.value;
|
||||
delete stackDescriptor.writable;
|
||||
|
||||
stackDescriptor.set = function (newstack) {
|
||||
overwrittenStack = newstack;
|
||||
};
|
||||
|
||||
stackDescriptor.get = function () {
|
||||
var stack = (stackGetter)
|
||||
? stackGetter.call(this).split(/\r?\n+/g)
|
||||
: stackValue.split(/\r?\n+/g);
|
||||
var stack = (overwrittenStack || ((stackGetter)
|
||||
? stackGetter.call(this)
|
||||
: stackValue)).split(/\r?\n+/g);
|
||||
|
||||
// starting in Node 7, the stack builder caches the message.
|
||||
// just replace it.
|
||||
stack[0] = this.name + ': ' + this.message;
|
||||
if (!overwrittenStack) {
|
||||
stack[0] = this.name + ': ' + this.message;
|
||||
}
|
||||
|
||||
var lineCount = 1;
|
||||
for (var key in properties) {
|
||||
|
||||
Reference in New Issue
Block a user