You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, guys! I found out, that when i pass object with errors to updateInputsWithError, and there's no corresponding component in my form, an error is thrown.
Here's code snippet responsible for that.
updateInputsWithError = (errors) => {
Object.keys(errors).forEach((name) => {
const component = utils.find(this.inputs, input => input.props.name === name);
if (!component) {
throw new Error(`You are trying to update an input that does not exist. Verify errors object with input names. ${JSON.stringify(errors)}`);
}
....
Wouldn't it be better if warning has been shown, instead of error thrown?
Because I don't want my app to stop, when server sends more errors, than my form has?
The text was updated successfully, but these errors were encountered:
bamaboy
changed the title
Prevent updateInputsWithError to throw error if component not found
Prevent updateInputsWithError to throw error if corresponding component not found
Jan 20, 2019
That's an interesting point. Can you just surround your updateInputsWithError with a try-catch? The downside to warnings is they can't be caught and handled.
Hi, guys! I found out, that when i pass object with errors to
updateInputsWithError
, and there's no corresponding component in my form, an error is thrown.Here's code snippet responsible for that.
Wouldn't it be better if warning has been shown, instead of error thrown?
Because I don't want my app to stop, when server sends more errors, than my form has?
The text was updated successfully, but these errors were encountered: