Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
const StackUtils = require('stack-utils');
const original = StackUtils.prototype.parseLine;
let restored = false;
let restoreAfterFirstCall = false;
StackUtils.prototype.parseLine = function (line) {
if (restored) {
return original.call(this, line);
}
if (restoreAfterFirstCall) {
restored = true;
}
throw new Error('Forced error');
};
exports.restoreAfterFirstCall = () => {
restoreAfterFirstCall = true;
'use strict';
const StackUtils = require('stack-utils');
const original = StackUtils.prototype.parseLine;
let restored = false;
let restoreAfterFirstCall = false;
StackUtils.prototype.parseLine = function (line) {
if (restored) {
return original.call(this, line);
}
if (restoreAfterFirstCall) {
restored = true;
}
throw new Error('Forced error');
};
exports.restoreAfterFirstCall = () => {
restoreAfterFirstCall = true;
};