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
optimacms-0.1.61 spec/dummy/node_modules/css-tree/lib/utils/createCustomError.js
optimacms-0.1.61 spec/dummy/node_modules/csso/node_modules/css-tree/lib/utils/createCustomError.js
disco_app-0.18.0 test/dummy/node_modules/css-tree/lib/utils/createCustomError.js
disco_app-0.18.0 test/dummy/node_modules/csso/node_modules/css-tree/lib/utils/createCustomError.js
disco_app-0.18.2 test/dummy/node_modules/csso/node_modules/css-tree/lib/utils/createCustomError.js
disco_app-0.18.2 test/dummy/node_modules/css-tree/lib/utils/createCustomError.js
disco_app-0.16.1 test/dummy/node_modules/css-tree/lib/utils/createCustomError.js
disco_app-0.16.1 test/dummy/node_modules/csso/node_modules/css-tree/lib/utils/createCustomError.js
disco_app-0.15.2 test/dummy/node_modules/csso/node_modules/css-tree/lib/utils/createCustomError.js
disco_app-0.15.2 test/dummy/node_modules/css-tree/lib/utils/createCustomError.js
disco_app-0.18.4 test/dummy/node_modules/css-tree/lib/utils/createCustomError.js
disco_app-0.18.4 test/dummy/node_modules/csso/node_modules/css-tree/lib/utils/createCustomError.js
disco_app-0.18.1 test/dummy/node_modules/css-tree/lib/utils/createCustomError.js
disco_app-0.18.1 test/dummy/node_modules/csso/node_modules/css-tree/lib/utils/createCustomError.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/css-tree/lib/utils/createCustomError.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/csso/node_modules/css-tree/lib/utils/createCustomError.js
disco_app-0.14.0 test/dummy/node_modules/csso/node_modules/css-tree/lib/utils/createCustomError.js
disco_app-0.14.0 test/dummy/node_modules/css-tree/lib/utils/createCustomError.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/css-tree/lib/utils/createCustomError.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/csso/node_modules/css-tree/lib/utils/createCustomError.js