new Error to Error

This commit is contained in:
the-djmaze 2024-03-04 01:12:40 +01:00
parent 870019d2df
commit 644c8ad389
13 changed files with 44 additions and 44 deletions

View file

@ -19,7 +19,7 @@ ko.dependencyDetection = {
registerDependency: subscribable => {
if (currentFrame) {
if (!ko.isSubscribable(subscribable))
throw new Error("Only subscribable things can act as dependencies");
throw Error("Only subscribable things can act as dependencies");
currentFrame.callback.call(currentFrame.callbackTarget, subscribable,
subscribable._id || (subscribable._id = ++lastId));
}

View file

@ -36,7 +36,7 @@ ko.computed = (evaluatorFunctionOrOptions, options) => {
function computedObservable() {
if (arguments.length > 0) {
if (typeof writeFunction !== "function") {
throw new Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");
throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");
}
// Writing a value
writeFunction(...arguments);

View file

@ -2,7 +2,7 @@ ko['observableArray'] = initialValues => {
initialValues = initialValues || [];
if (!Array.isArray(initialValues))
throw new Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");
throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");
return Object.setPrototypeOf(ko.observable(initialValues), ko['observableArray']['fn']).extend({'trackArrayChanges':true});
};