|| (errorCode != null && (error.getCode().endsWith(".Duplicate") || error.getCode().endsWith(
".InUse")))
|| (message != null && (message.indexOf("already exists") != -1 || message.indexOf("is in use") != -1)))
exception = new IllegalStateException(message, exception);
else if (errorCode != null && errorCode.indexOf("AuthFailure") != -1)
exception = new AuthorizationException(message, exception);
else if (message != null
&& (message.indexOf("Invalid id") != -1 || message.indexOf("Failed to bind") != -1))
exception = new IllegalArgumentException(message, exception);
break;
case 401:
case 403:
exception = new AuthorizationException(message, exception);
break;
case 404:
if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
exception = new ResourceNotFoundException(message, exception);
}