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

@ -33,7 +33,7 @@
}
if (!componentName) {
throw new Error('No component name specified');
throw Error('No component name specified');
}
var asyncContext = ko.bindingEvent.startPossiblyAsyncContentBinding(element, bindingContext);
@ -47,12 +47,12 @@
// Instantiate and bind new component. Implicitly this cleans any old DOM nodes.
if (!componentDefinition) {
throw new Error('Unknown component \'' + componentName + '\'');
throw Error('Unknown component \'' + componentName + '\'');
}
// cloneTemplateIntoElement
var template = componentDefinition['template'];
if (!template) {
throw new Error('Component \'' + componentName + '\' has no template');
throw Error('Component \'' + componentName + '\' has no template');
}
ko.virtualElements.setDomNodeChildren(element, ko.utils.cloneNodes(template));

View file

@ -34,11 +34,11 @@
'register': (componentName, config) => {
if (!config) {
throw new Error('Invalid configuration for ' + componentName);
throw Error('Invalid configuration for ' + componentName);
}
if (defaultConfigRegistry[componentName]) {
throw new Error('Component ' + componentName + ' is already registered');
throw Error('Component ' + componentName + ' is already registered');
}
defaultConfigRegistry[componentName] = config;
@ -57,7 +57,7 @@
var defaultConfigRegistry = Object.create(null),
createViewModelKey = 'createViewModel',
throwError = (componentName, message) => { throw new Error(`Component '${componentName}': ${message}`) },
throwError = (componentName, message) => { throw Error(`Component '${componentName}': ${message}`) },
// Takes a config object of the form { template: ..., viewModel: ... }, and asynchronously convert it
// into the standard component definition format: