Skip to main content

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.

InvoicePlaneError.java
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 {}.

invoiceplane_error.properties
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 , CsErrorNodeError 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 CodeDescription
E1000Unexpected fatal error
E1001Unexpected error occurs
E1002Booting error occurs
E1003Booting error: module instantiation error
E1004Unable to load a configuration file or no configuration file provided
E2000Configuration key is not defined
E2001Wrong configuration value
E2002The specified configuration has wrong structure
E2003Cannot find data
E2004S3 is not configured
E2005General configuration error
E3000Execution error occurs in module
E3001Execution error occurs in task
E3002Instance creation error
E3003Can not inject fields into instance
E3004Can not execute annotated method for instance
E3005Execution stopped at task
E5000REST service call failed
E5001Network timeout
E5002REST call failed: standalone mode
E5003An error occurs during uploading file to S3
E5004An error occurs during generation of S3 url
E5005An error occurs during downloading file from S3
E6000Database consistency error
E6001Database foreign constraint error
E6002Database unique constraint error
E6003Database duplicate record error
E6004Datasource persistence error
E6005Datasource SQL error
E6006Datasource error: cannot determine table
E7000Secret vault error
E7001No trust store password found
E7002No MongoDb password found
E7003General security exception
E7004Secret vault unsealing error
E7005An error occurs during processing of file with secret configuration
E7006Secret alias contains illegal characters
E8000An error occurs during closing the driver
E8001An error occurs during page creation
E8002An error occurs during driver initialization
E8003There is not current window for driver
E8004Can't switch to window. Window with the following selector not found
E8005An error occurs during opening application
E8006An error occurs during taking screenshot
E8007Timeout during waiting for UI element
E8008Text validation error for UI element
E8009List of opened windows is empty
E8010Cannot find UI element on the screen
E8011Can't launch application*/
E8012Can't get windows
E8013Unexpected 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 CodeHTTP CodeDescription
S1000500Unexpected error occurs 
S4000401User is disabled 
S4001401Invalid credentials for user 
S4002403Access denied 
S4003404Entity not found 
S4004400Wrong input format 
S4005400CSV error 
S4006400Wrong input 
S4007400Method arguments are not valid 
S4008400Invalid cron expression 
S4009400Wrong input format: type mismatch 
S4010400Wrong input format: missing request parameter 
S4011401User does not exist 
S4012401Wrong token 
S4013400Wrong input format: DataStore record 
S4014400Wrong input: missing DataStore record in request
S4015400Wrong input: either schema or csv file is accepted but not both
S4016400Please provide valid JSON 
S4017400Cannot extract zip package 
S4018400Wrong structure of ap package 
S4019400CSV header error 
S3000500Asynchronous job exception 
S6000500Database consistency error 
S6001500Database foreign constraint error 
S6002500Database unique constraint error 
S6003500Database duplicate record error 
S6004500Datasource persistence error 
S6005500Datasource error 
S6007500Automation process with the same name already exists
S6008500Data Store with the same name already exists
S6009500Schedule with the same name already exists
S6010500Node with the same name already exists
S6011500Role with the same name already exists
S6012500NodeConfiguration parameter with the same key already exists
S6013500Secret entry with the same alias already exists
S6014500User with the same username already exists
S6015500Capability with the same name already exists
S7000500Secret vault error 

NodeError

These exceptions occur on node agent only

Exception CodeDescription
N1000Unexpected error
N2000No configuration found
N3000Multiply nodes
N4000Communicate with another JVM failed