Skip to content
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

display validation errors in a more accesible manner #254

Open
MJochim opened this issue Mar 8, 2018 · 2 comments
Open

display validation errors in a more accesible manner #254

MJochim opened this issue Mar 8, 2018 · 2 comments

Comments

@MJochim
Copy link
Contributor

MJochim commented Mar 8, 2018

In my opinion, errors during json validation contain very useful information that some users might be able to handle properly if they were presented in a different manner. Currently, this is what a validation error message looks like:

validation-error-screenshot

All the useful information is on the first line. The rest is basically the call stack and it is just overwhelming.

One very easy solution might be to delete the stack from the error object. In places like this:

modalService.open('views/error.html', 'Error validating annotation file: ' + JSON.stringify(validRes, null, 4)).then(function () {
(there are a number of such places, try grep -r "Error validating" EMU-webApp/app/), calling delete validRes.stack; should do.

A more advanced approach would be to generate an even easier-to-read version by only looking at validRes.dataPath and validRes.message (and maybe validRes.code - don't know what that code means).

@raphywink
Copy link
Contributor

I don't know what you mean... I find that error message totaly legible :-). Kidding aside, I agree and we could try to do what you suggested but we would have to be carefull that validRes.stack is available for every error object we throw. Some of the server errors might be handled slightly differently (but I might be wrong). Would just mean we have to double check all the promise error handeling... not alot of fun but definately doable!

@MJochim
Copy link
Contributor Author

MJochim commented Mar 8, 2018

I don't know what you mean... I find that error message totaly legible :-)

now that you say it - fällt es mir wie Schuppen von den Augen ("like scales from my eyes" - can you say that? ;))

It would of course make sense to make sure we are dealing with the same kind of error object every time. On the other hand, we can't really break anything, as delete validRes.stack won't do anything when stack does not exist on the object (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete). The only time delete throws is "in strict mode if the property is an own non-configurable property." I don't think this is the case for the stack property (might however double-check that).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants