-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Review ElementErrors and tie up any loose ends #4036
Comments
Let's divide this issue into smaller ones (attached to #3478), in order of complexity:
|
From a discussion on slack: We may want to look at removing the |
Maybe it's a sign that we need to have the I'd like to propose something like the following (the passing of the class ElementError extends Error {
name = 'ElementError'
}
function missingMessage(identifier) {
return `${identifier} is missing`
}
// Two little updates here:
// - identifier as first param to keep in line with the `missingElementMessage
//
function missingOrMistypedMessage(identifier, {value, expectedType = HTMLElement.name}) {
if (!value) return missingElementMessage(identifier)
return `${identifier} is not of the type ${expectedType}`
}
throw new ElementError(missingMessage('button'));
throw new ElementError(missingOrMistypedMessage('input', {value: $input}); Depends on how we want to word things for #4072, and is an internal refactoring so could wait if necessary. |
What
Review the MissingElementError work (tracked here: #3478) and tie up any loose ends before a content review.
Why
This is part of our work to have our components throw rather than silently return during initialisation.
Who needs to work on this
Developers
Who needs to review this
Developers
Done when
The text was updated successfully, but these errors were encountered: