From 14bee5d3bda241ed466379e89f950e16f64b7f7d Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Wed, 28 Feb 2024 19:46:21 +0100 Subject: [PATCH] `new Error()` to `Error()` --- dev/Common/Translator.js | 2 +- dev/DAV/JCard.js | 12 ++++++------ dev/DAV/VCardProperty.js | 2 +- dev/External/ko.js | 2 +- dev/Knoin/AbstractModel.js | 2 +- dev/Model/AbstractCollection.js | 2 +- dev/Sieve/Model/Abstract.js | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dev/Common/Translator.js b/dev/Common/Translator.js index 0b609a99d..f67aae246 100644 --- a/dev/Common/Translator.js +++ b/dev/Common/Translator.js @@ -211,7 +211,7 @@ export const script.remove(); resolve(); }; - script.onerror = () => reject(new Error('Language '+language+' failed')); + script.onerror = () => reject(Error('Language '+language+' failed')); script.src = langLink(language, admin); // script.async = true; doc.head.append(script); diff --git a/dev/DAV/JCard.js b/dev/DAV/JCard.js index 56c247e67..1dad7d8c8 100644 --- a/dev/DAV/JCard.js +++ b/dev/DAV/JCard.js @@ -15,7 +15,7 @@ export class JCard { if (input) { // read from jCard if (typeof input !== 'object') { - throw new Error('error reading vcard') + throw Error('error reading vcard') } this.parseFromJCard(input) } @@ -87,7 +87,7 @@ export class JCard { arg = new VCardProperty(String(arg), value, params, type); } if (!(arg instanceof VCardProperty)) { - throw new Error('invalid argument of VCard.set(), expects string arguments or a VCardProperty'); + throw Error('invalid argument of VCard.set(), expects string arguments or a VCardProperty'); } let field = arg.getField(); this.props.set(field, [arg]); @@ -101,7 +101,7 @@ export class JCard { arg = new VCardProperty(String(arg), value, params, type); } if (!(arg instanceof VCardProperty)) { - throw new Error('invalid argument of VCard.add(), expects string arguments or a VCardProperty'); + throw Error('invalid argument of VCard.add(), expects string arguments or a VCardProperty'); } // VCardProperty arguments let field = arg.getField(); @@ -125,14 +125,14 @@ export class JCard { else if (arg instanceof VCardProperty) { let propArray = this.props.get(arg.getField()); if (!(propArray === null || propArray === void 0 ? void 0 : propArray.includes(arg))) - throw new Error("Attempted to remove VCardProperty VCard does not have: ".concat(arg)); + throw Error("Attempted to remove VCardProperty VCard does not have: ".concat(arg)); propArray.splice(propArray.indexOf(arg), 1); if (propArray.length === 0) this.props.delete(arg.getField()); } // incorrect arguments else - throw new Error('invalid argument of VCard.remove(), expects ' + + throw Error('invalid argument of VCard.remove(), expects ' + 'string and optional param filter or a VCardProperty'); } @@ -202,7 +202,7 @@ export class JCard { parseFullName(options) { let n = this.getOne('n'); if (n === undefined) { - throw new Error('\'fn\' VCardProperty not present in card, cannot parse full name'); + throw Error('\'fn\' VCardProperty not present in card, cannot parse full name'); } let fnString = ''; // Position in n -> position in fn diff --git a/dev/DAV/VCardProperty.js b/dev/DAV/VCardProperty.js index 59c290e67..30fd8813e 100644 --- a/dev/DAV/VCardProperty.js +++ b/dev/DAV/VCardProperty.js @@ -55,7 +55,7 @@ export class VCardProperty { } // invalid property else { - throw new Error('invalid Property constructor'); + throw Error('invalid Property constructor'); } } diff --git a/dev/External/ko.js b/dev/External/ko.js index 53425caa9..7022c646f 100644 --- a/dev/External/ko.js +++ b/dev/External/ko.js @@ -107,7 +107,7 @@ Object.assign(ko.bindingHandlers, { const command = fValueAccessor(); if (!command || !command.canExecute) { - throw new Error('Value should be a command'); + throw Error('Value should be a command'); } ko.bindingHandlers['FORM'==element.nodeName ? 'submit' : 'click'].init( diff --git a/dev/Knoin/AbstractModel.js b/dev/Knoin/AbstractModel.js index 724cf3dce..0fb0b2d90 100644 --- a/dev/Knoin/AbstractModel.js +++ b/dev/Knoin/AbstractModel.js @@ -27,7 +27,7 @@ export class AbstractModel { constructor() { /* if (new.target === AbstractModel) { - throw new Error("Can't instantiate AbstractModel!"); + throw Error("Can't instantiate AbstractModel!"); } */ Object.defineProperty(this, 'disposables', {value: []}); diff --git a/dev/Model/AbstractCollection.js b/dev/Model/AbstractCollection.js index 35c70413c..e4a9d0910 100644 --- a/dev/Model/AbstractCollection.js +++ b/dev/Model/AbstractCollection.js @@ -5,7 +5,7 @@ export class AbstractCollectionModel extends Array constructor() { /* if (new.target === AbstractCollectionModel) { - throw new Error("Can't instantiate AbstractCollectionModel!"); + throw Error("Can't instantiate AbstractCollectionModel!"); } */ super(); diff --git a/dev/Sieve/Model/Abstract.js b/dev/Sieve/Model/Abstract.js index 84c534ee0..3130fd175 100644 --- a/dev/Sieve/Model/Abstract.js +++ b/dev/Sieve/Model/Abstract.js @@ -22,7 +22,7 @@ export class AbstractModel { constructor() { /* if (new.target === AbstractModel) { - throw new Error("Can't instantiate AbstractModel!"); + throw Error("Can't instantiate AbstractModel!"); } */ Object.defineProperty(this, 'disposables', {value: []});