I am developing a module which internally uses AWS Java SDK client to make EC2 related API calls.
E.g. I have a requirement where I need to attach ENIs to my instance. One of the possible error code in this api call is AttachmentLimitExceeded
, I want to execute another logic if this particular error is thrown. I know I can retrieve this error code using AmazonServiceException.getErrorCode()
method. But is there any jar which includes all the possible error code strings or exception classes which I can use to handle such error codes and lets say have a switch case depending on each error code?
I do not want to do a hardcoded string matching like
AmazonServiceException.getErrorCode().equals("AttachmentLimitExceeded");
Since this code will need changes as and when AWS changes their error codes. What is the standard way of including these error codes in third party project?