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
Disable mode drop down if contnents are invalid json #1364
Comments
I think not only mode drop but also all operation buttons should be disabled except 'Repair Json' |
In text mode, when the text contents is no valid, parsable JSON, various features cannot be executed: expand, collapse, switch to tree mode, ... When you try to execute those actions, an error will be thrown. By default, this error is logged in the console only. You can catch the error yourself and do something alternative, like presenting the error to the user in a modal or something like that: const options = {
onError: function (err) {
alert(err.toString())
}
} Thinking about it, it may be better default behavior to show such a basic alert to the user on error instead of logging in the console. In general I try to be careful with disabling buttons: it's easily not clear for a user why a button is disabled and what the user needs to do to get it enabled, so showing an explanatory error to the user when an action cannot be performed has my preference. |
…nstead of logging the error in the console (see #1364).
I've changed the default behavior to open a basic alert when an error occurs, see cbb95ae |
Showing error will be more useful. |
Hm, that should not be the case. I'll double check it |
You're right. I'll fix that. |
Thanks :) |
…N contents not triggering the `onError` callback (see #1364)
Fixed via b3b31f2 (not yet published) |
Fixes/improvements are published now in |
Now error is shown in alert box instead of console. |
…nstead of logging the error in the console (see josdejong#1364).
…N contents not triggering the `onError` callback (see josdejong#1364)
Steps to reproduce -
1.Enter valid json content.
2.Delete some semicolon in order to create invalid json.
3.Try to change mode.
4.Console shows error.
Expected - Mode drop down should be disabled if contents are invalid json
The text was updated successfully, but these errors were encountered: