Skip to content

Conversation

@wbingli
Copy link

@wbingli wbingli commented May 15, 2020

Issue #, if available: #243

Description of changes:. Fix the error message issue for BaseHandlerException.

Cloudformation service doesn't like empty message exception, use the cause exception as default exception message.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@miparnisari
Copy link
Contributor

miparnisari commented May 15, 2020

So this is why this code

try {
            awsResponse = proxyClient.injectCredentialsAndInvokeV2(awsRequest, proxyClient.client()::deleteMetricFilter);
        } catch (ResourceNotFoundException e) {
            logger.log("Resource does not exist and could not be deleted.");
            throw new CfnNotFoundException(e);
        }

causes this to be printed in the handler logs...


  | 2020-05-15T15:00:53.943-07:00 | Resource does not exist and could not be deleted.
  | 2020-05-15T15:00:54.011-07:00 | null in a DELETE action on a AWS::Logs::MetricFilter: 
software.amazon.cloudformation.exceptions.CfnNotFoundExceptionsoftware.amazon.cloudformation.exceptions.CfnNotFoundException	
at software.amazon.logs.metricfilter.DeleteHandler.deleteResource(DeleteHandler.java:51)

super(ERROR_CODE.getMessage(), ERROR_CODE);
}

public CfnInvalidCredentialsException(final Throwable cause) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any reason to limit all of these exceptions to just having a cause constructor. Can we include a (cause) and a (message, cause) for all of them?

Copy link
Author

@wbingli wbingli Jun 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion. However, I'm afraid it will be other large change to add all exception to support this new constructor as well as make the BaseHandlerException correct.

I would prefer to add this new constructor as new feature, but this PR will focus to fix this known bug.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we create an issue to resolve this then, if we're not going to include it in this PR?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tracked in #276

Wenbing Li added 2 commits June 10, 2020 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants