Initial commit
This commit is contained in:
14
node_modules/css-tree/lib/utils/create-custom-error.js
generated
vendored
Normal file
14
node_modules/css-tree/lib/utils/create-custom-error.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
export function createCustomError(name, message) {
|
||||
// use Object.create(), because some VMs prevent setting line/column otherwise
|
||||
// (iOS Safari 10 even throws an exception)
|
||||
const error = Object.create(SyntaxError.prototype);
|
||||
const errorStack = new Error();
|
||||
|
||||
return Object.assign(error, {
|
||||
name,
|
||||
message,
|
||||
get stack() {
|
||||
return (errorStack.stack || '').replace(/^(.+\n){1,3}/, `${name}: ${message}\n`);
|
||||
}
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user