Sha256: 9345a8e7d3a71f1d61bf8c3c942ad00ea5a7c211cb68b385bd39aadbc4d4f7f4
Contents?: true
Size: 543 Bytes
Versions: 61
Compression:
Stored size: 543 Bytes
Contents
module.exports = function createCustomError(name, message) { // use Object.create(), because some VMs prevent setting line/column otherwise // (iOS Safari 10 even throws an exception) var error = Object.create(SyntaxError.prototype); var errorStack = new Error(); error.name = name; error.message = message; Object.defineProperty(error, 'stack', { get: function() { return (errorStack.stack || '').replace(/^(.+\n){1,3}/, name + ': ' + message + '\n'); } }); return error; };
Version data entries
61 entries across 33 versions & 10 rubygems