kh90909 / OakTerm

Serial terminal for the Digistump Oak over the Particle Cloud
8 stars 2 forks source link

Login form should reveal errors #11

Closed emcniece closed 8 years ago

emcniece commented 8 years ago

This might have been a UI rework-induced bug, but as it stands the login form does not show authentication errors. Make it so!

emcniece commented 8 years ago

In progress.

kh90909 commented 8 years ago

This is somewhat distinct from error handling on later API queries, at least from a UI perspective, but my plan for error handling was to extend the use of promises, using mutiple .catch(<error_handler_function>) calls in the main promise chain. If it's necessary to terminate the promise chain at any point, we can use the approach of returning a new rejected promise as described here.

On the UI side, for errors after login, I imagined displaying a modal dialog explaining the error and giving the user the option to retry or go back to the login screen. This is different from the login situation, where I'd say the convention is to display the error inline with the login form.

emcniece commented 8 years ago

Agreed. https://github.com/kh90909/OakTerm/pull/12 introduces the .catch() handler that was commented out, and this will work great for the API auth errors.

We have 2 login form error sources: local validation (empty form fields), and remote validation (API calls). I was starting to add field-level validation, but you're right - the API handles this gracefully already, so there's no sense in adding a bunch of local handling!

Good catch.

emcniece commented 8 years ago

Ready for testing

emcniece commented 8 years ago

Complete!