Exception Handling
Exception Handling
EasyRPA Exception Handling Mechanism
Developer has three options when dealing with exception inside AP :
- catch it inside AP and hence prevent AP from termination with 'failed' status
- rethrow or left it propagated down the call stack to be eventually handled by engine
- declare
@OnError
handler to tell engine the way to deal with exceptions not handled directly by developer
The best way to rethrow is to define AP specific exceptions, more on this further
Define Specific AP Exceptions
Developer can define AP-related errors by implementing eu.ibagroup.easyrpa.engine.exception.ErrorDetails
interface onto enumeration class.
It is recommended to store error messages as resource bundle.
public enum InvoicePlaneError implements ErrorDetails { LOGIN_FAILED, ADD_PRODUCT_FAILED; private static ResourceBundle rb = ResourceBundle.getBundle("invoiceplane_error"); public String getMessageTemplate() { return rb.getString(this.name()); } }
Error messages are defined in corresponding resource bundle, where each key matches the error name from enumeration.
The message can contain arbitrary number of parameters enclosed in {}.
LOGIN_FAILED=Login failed with user {0} ADD_PRODUCT_FAILED=Add failed for product {0}
Now to make use of newly created exception simply throw eu.ibagroup.easyrpa.engine.exception.EasyRpaException
and pass the arguments if the message requires them.
if (loginFailed) { throw new EasyRpaException(InvoicePlaneError.LOGIN_FAILED, credentials.getUser()); }
Built-in Exceptions
EasyRPA engine comes with a number of predefined exceptions.
They can be found grouped in three classes: CoreError
, CsError
, NodeError
depending on scope and domain specifics.
All these classes are essentially enumerations implementing eu.ibagroup.easyrpa.engine.exception.ErrorDetails
interface.
CoreError
These are exceptions related to inner workings of engine, such as issues with driver, data, AP execution etc.
Exception Code | Description |
---|---|
E1000 | Unexpected fatal error |
E1001 | Unexpected error occurs |
E1002 | Booting error occurs |
E1003 | Booting error: module instantiation error |
E1004 | Unable to load a configuration file or no configuration file provided |
E2000 | Configuration key is not defined |
E2001 | Wrong configuration value |
E2002 | The specified configuration has wrong structure |
E2003 | Cannot find data |
E2004 | S3 is not configured |
E2005 | General configuration error |
E3000 | Execution error occurs in module |
E3001 | Execution error occurs in task |
E3002 | Instance creation error |
E3003 | Can not inject fields into instance |
E3004 | Can not execute annotated method for instance |
E3005 | Execution stopped at task |
E5000 | REST service call failed |
E5001 | Network timeout |
E5002 | REST call failed: standalone mode |
E5003 | An error occurs during uploading file to S3 |
E5004 | An error occurs during generation of S3 url |
E5005 | An error occurs during downloading file from S3 |
E6000 | Database consistency error |
E6001 | Database foreign constraint error |
E6002 | Database unique constraint error |
E6003 | Database duplicate record error |
E6004 | Datasource persistence error |
E6005 | Datasource SQL error |
E6006 | Datasource error: cannot determine table |
E7000 | Secret vault error |
E7001 | No trust store password found |
E7002 | No MongoDb password found |
E7003 | General security exception |
E7004 | Secret vault unsealing error |
E7005 | An error occurs during processing of file with secret configuration |
E7006 | Secret alias contains illegal characters |
E8000 | An error occurs during closing the driver |
E8001 | An error occurs during page creation |
E8002 | An error occurs during driver initialization |
E8003 | There is not current window for driver |
E8004 | Can't switch to window. Window with the following selector not found |
E8005 | An error occurs during opening application |
E8006 | An error occurs during taking screenshot |
E8007 | Timeout during waiting for UI element |
E8008 | Text validation error for UI element |
E8009 | List of opened windows is empty |
E8010 | Cannot find UI element on the screen |
E8011 | Can't launch application*/ |
E8012 | Can't get windows |
E8013 | Unexpected driver error |
CsError
This class comprises the exceptions derived from HTTP error codes and related to server-side issues such as access control, database integrity and others.
Exception Code | HTTP Code | Description |
---|---|---|
S1000 | 500 | Unexpected error occurs |
S4000 | 401 | User is disabled |
S4001 | 401 | Invalid credentials for user |
S4002 | 403 | Access denied |
S4003 | 404 | Entity not found |
S4004 | 400 | Wrong input format |
S4005 | 400 | CSV error |
S4006 | 400 | Wrong input |
S4007 | 400 | Method arguments are not valid |
S4008 | 400 | Invalid cron expression |
S4009 | 400 | Wrong input format: type mismatch |
S4010 | 400 | Wrong input format: missing request parameter |
S4011 | 401 | User does not exist |
S4012 | 401 | Wrong token |
S4013 | 400 | Wrong input format: DataStore record |
S4014 | 400 | Wrong input: missing DataStore record in request |
S4015 | 400 | Wrong input: either schema or csv file is accepted but not both |
S4016 | 400 | Please provide valid JSON |
S4017 | 400 | Cannot extract zip package |
S4018 | 400 | Wrong structure of ap package |
S4019 | 400 | CSV header error |
S3000 | 500 | Asynchronous job exception |
S6000 | 500 | Database consistency error |
S6001 | 500 | Database foreign constraint error |
S6002 | 500 | Database unique constraint error |
S6003 | 500 | Database duplicate record error |
S6004 | 500 | Datasource persistence error |
S6005 | 500 | Datasource error |
S6007 | 500 | Automation process with the same name already exists |
S6008 | 500 | Data Store with the same name already exists |
S6009 | 500 | Schedule with the same name already exists |
S6010 | 500 | Node with the same name already exists |
S6011 | 500 | Role with the same name already exists |
S6012 | 500 | NodeConfiguration parameter with the same key already exists |
S6013 | 500 | Secret entry with the same alias already exists |
S6014 | 500 | User with the same username already exists |
S6015 | 500 | Capability with the same name already exists |
S7000 | 500 | Secret vault error |
NodeError
These exceptions occur on node agent only
Exception Code | Description |
---|---|
N1000 | Unexpected error |
N2000 | No configuration found |
N3000 | Multiply nodes |
N4000 | Communicate with another JVM failed |