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
fix(xo-web/editable/number): throw error if onChange fails #5634
Conversation
|
||
this.props.onChange(value, params) | ||
await this.props.onChange(value, params) | ||
} catch (error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code above the onChange
cannot throw an error.
} catch (error) { | ||
throw error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the point of catching an error just to rethrow it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, the important change appears to be the await
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the point of catching an error just to rethrow it.
The current behaviour is: if we edit a number and it's failing, the UI are not displaying an error, and for the user it's look like it worked.
Eg: If you try to edit a rate limit network
as viewer, the modification will fail, and a success tooltip will appear next to the input
By throwing an error in the case of failure, the error tooltip is displayed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MathieuRA Your comment does not explain why the try
/catch
is necessary.
Because what you're doing right now is catch an exception and then rethrow it, which is the same as not catching it in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ho okay, i understand.
So only the await
is necessary
Check list
Fixes #007
orSee xoa-support#42
)CHANGELOG.unreleased.md
:${name} v${new version}
)cron/parse.spec.js
)xo-server
API changes, the corresponding test has been added to/updated onxo-server-test
Process
WiP:
(Work in Progress) if not ready to be mergedFrom the Four Agreements: