July 2019
Intermediate to advanced
536 pages
12h 57m
English
In cases where the user can predict when an error might occur in the application, they can check for that error and explicitly raise an exception if it is found. Take the login function of a browser or mobile application as an example. If the user credentials are incorrect, the app will throw an exception saying something like "username invalid, try again" or "password incorrect, please re-enter".
The exception can be explicitly handled in a way that the actual error message can be thrown in the exception. Here is an example of the login method we wrote earlier with exception handling added to it:
@FindBy(id="myApp_exception")protected M error;/** * login - method to login to app with error handling * * @param ...
Read now
Unlock full access