You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cfn error code exceptions do not use error messages from the cause exception, omitting service level error messages and request Ids #243
We created exceptions to represent the different error codes, specifically:
CfnAccessDeniedException
CfnAlreadyExistsException
CfnGeneralServiceException
CfnInternalFailureException
CfnInvalidCredentialsException
CfnInvalidRequestException
CfnNetworkFailureException
CfnNotFoundException
CfnNotStabilizedException
CfnNotUpdatableException
CfnResourceConflictException
CfnServiceInternalErrorException
CfnServiceLimitExceededException
CfnThrottlingException
The idea is that the handler would throw this exception, and the java plugin would convert that to a ProgressEvent with a FAILED status. However, these exceptions do not take error messages, which is required when there is a FAILED ProgressEvent.
Also, these exceptions should extend a common BaseErrorCodeException or somehting like that, so we can easily catch this. Handlers should not be throwing any other type of exception from their code.
Lastly, NotFound and AlreadyExists have duplicate exceptions, and I'm not sure what they are for:
ResourceNotFoundException and CfnNotFoundException
ResourceAlreadyExistsException and CfnAlreadyExistsException
changed the title [-]Cfn error code exceptions do not take error messages[/-][+]Cfn error code exceptions do not take error messages/are implemented incorrectly[/+]on Apr 17, 2020
add documentation that while it is required to return a progress event, handlers using the java plugin can throw a BaseHandlerException, which will be translated into a Progress Event by wrapper. This is the only acceptable exception to be thrown, otherwise they will see internal failure
changed the title [-]Cfn error code exceptions do not take error messages/are implemented incorrectly[/-][+]Cfn error code exceptions do not use error messages[/+]on Apr 17, 2020
changed the title [-]Cfn error code exceptions do not use error messages[/-][+]Cfn error code exceptions do not use error messages from the cause, omitting service level error messages and request Ids[/+]on Apr 17, 2020
changed the title [-]Cfn error code exceptions do not use error messages from the cause, omitting service level error messages and request Ids[/-][+]Cfn error code exceptions do not use error messages from the cause exception, omitting service level error messages and request Ids[/+]on Apr 17, 2020
Activity
[-]Cfn error code exceptions do not take error messages[/-][+]Cfn error code exceptions do not take error messages/are implemented incorrectly[/+]aygold92 commentedon Apr 17, 2020
After doing a bit of digging it looks like we actually should use exception messages
cloudformation-cli-java-plugin/src/main/java/software/amazon/cloudformation/proxy/ExceptionMessages.java
Line 17 in ddfbcbf
aygold92 commentedon Apr 17, 2020
it also looks we use BaseHandlerException which includes the ErrorCode
cloudformation-cli-java-plugin/src/main/java/software/amazon/cloudformation/exceptions/BaseHandlerException.java
Line 20 in ddfbcbf
aygold92 commentedon Apr 17, 2020
it looks like really what the work is:
BaseHandlerExceptions to include AWS error messages/requestIdsNote:
ResourceAlreadyExistsExceptionactually extendsCfnAlreadyExistsExceptionandResourceNotFoundExceptionextendsCfnNotFoundException, so again the issue is just we omit the service level exception message/requestIdhttps://github.com/aws-cloudformation/cloudformation-cli-java-plugin/blob/master/src/main/java/software/amazon/cloudformation/exceptions/ResourceAlreadyExistsException.java
https://github.com/aws-cloudformation/cloudformation-cli-java-plugin/blob/master/src/main/java/software/amazon/cloudformation/exceptions/ResourceNotFoundException.java
BaseHandlerException, which will be translated into a Progress Event by wrapper. This is the only acceptable exception to be thrown, otherwise they will see internal failureTerminalExceptionhttps://github.com/aws-cloudformation/cloudformation-cli-java-plugin/blob/master/src/main/java/software/amazon/cloudformation/exceptions/TerminalException.java, which is not used or caught anywhere and is confusing[-]Cfn error code exceptions do not take error messages/are implemented incorrectly[/-][+]Cfn error code exceptions do not use error messages[/+][-]Cfn error code exceptions do not use error messages[/-][+]Cfn error code exceptions do not use error messages from the cause, omitting service level error messages and request Ids[/+][-]Cfn error code exceptions do not use error messages from the cause, omitting service level error messages and request Ids[/-][+]Cfn error code exceptions do not use error messages from the cause exception, omitting service level error messages and request Ids[/+]PatMyron commentedon Aug 26, 2020
looks like these should be deprecated to avoid conflicts:
cloudformation-cli-java-plugin/src/main/java/software/amazon/cloudformation/exceptions/ResourceNotFoundException.java
Lines 18 to 21 in 1dd595a
cloudformation-cli-java-plugin/src/main/java/software/amazon/cloudformation/exceptions/ResourceAlreadyExistsException.java
Lines 18 to 21 in 1dd595a
wbingli commentedon Sep 11, 2020
hmm, this issue should be fixed by #264
ammokhov commentedon Sep 22, 2020
closing this issue as has been fixed by #264