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

Version Path
isomorfeus-preact-10.5.7 node_modules/css-tree/lib/utils/createCustomError.js
isomorfeus-preact-10.5.6 node_modules/css-tree/lib/utils/createCustomError.js
isomorfeus-preact-10.5.5 node_modules/css-tree/lib/utils/createCustomError.js
isomorfeus-preact-10.5.4 node_modules/css-tree/lib/utils/createCustomError.js
isomorfeus-preact-10.5.3 node_modules/css-tree/lib/utils/createCustomError.js
isomorfeus-preact-10.5.2 node_modules/css-tree/lib/utils/createCustomError.js
tang-0.2.1 spec/tang_app/node_modules/csso/node_modules/css-tree/lib/utils/createCustomError.js
tang-0.2.1 spec/tang_app/node_modules/css-tree/lib/utils/createCustomError.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/css-tree/lib/utils/createCustomError.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/csso/node_modules/css-tree/lib/utils/createCustomError.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/css-tree/lib/utils/createCustomError.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/csso/node_modules/css-tree/lib/utils/createCustomError.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/css-tree/lib/utils/createCustomError.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/csso/node_modules/css-tree/lib/utils/createCustomError.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/csso/node_modules/css-tree/lib/utils/createCustomError.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/css-tree/lib/utils/createCustomError.js
tang-0.2.0 spec/tang_app/node_modules/css-tree/lib/utils/createCustomError.js
tang-0.2.0 spec/tang_app/node_modules/csso/node_modules/css-tree/lib/utils/createCustomError.js
tang-0.1.0 spec/tang_app/node_modules/css-tree/lib/utils/createCustomError.js
tang-0.1.0 spec/tang_app/node_modules/csso/node_modules/css-tree/lib/utils/createCustomError.js