added exception handling for invalid config and a nice warning

pull/6876/head
Tom Shaw 5 years ago
parent 929626fa92
commit 28a1e80647

@ -48,13 +48,21 @@ export function createEventDispatcher<
if (eventBinding) {
// in a server (non-DOM) environment?
const event = custom_event(type, detail);
try {
eventBinding[0].call(component, event, eventBinding[1].data);
} catch (e) {
console.warn(`A component was instantiated with invalid event:bindings - ${e}`);
}
}
if (catchAll) {
// in a server (non-DOM) environment?
try {
const event = custom_event(type, detail);
catchAll[0].call(component, event, catchAll[1].data);
} catch (e) {
console.warn(`A component was instantiated with invalid event:bindings - ${e}`);
}
}
};
}

Loading…
Cancel
Save