Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use different messages on lambda errors #381

Merged
merged 6 commits into from
Mar 7, 2018
Merged

Conversation

RaeesBhatti
Copy link
Contributor

No description provided.

Copy link
Contributor

@alexdebrie alexdebrie left a comment

Choose a reason for hiding this comment

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

@elsteelbrain I just tested this out, and I was getting the plain error message for the AccessDeniedException case.

I think the issue is actually here. Those three statements should be on the same line so that they're all converted to ErrFunctionAccessDenied instances (doc):

case "AccessDeniedException", "InvalidSignatureException", "UnrecognizedClientException":
    return nil, &ErrFunctionAccessDenied{awserr}

I didn't check ExpiredTokenException as I don't use tokens much, but I'm guessing we'll need to add it to that case statement list as well.

cc @mthenw

@RaeesBhatti
Copy link
Contributor Author

The syntax for case statement is correct. There must be a problem with the new if statement. I'll take a look again and update.

@RaeesBhatti
Copy link
Contributor Author

@alexdebrie The problem was that the previous implementation only changed error messages for HTTP events and not the invoke ones. I've updated the logic, so that, both cases are covered.

@RaeesBhatti RaeesBhatti dismissed alexdebrie’s stale review March 2, 2018 15:07

Updated as requested

@RaeesBhatti RaeesBhatti requested a review from mthenw March 2, 2018 15:47
@alexdebrie
Copy link
Contributor

@elsteelbrain This looks good by me now. Can you update the failing tests? Will wait on @mthenw for final approval.

@RaeesBhatti RaeesBhatti merged commit 6049ea7 into master Mar 7, 2018
@RaeesBhatti RaeesBhatti deleted the standardizeErrors branch March 7, 2018 15:00
@@ -318,6 +317,29 @@ func (router *Router) handleInvokeEvent(space string, functionID function.ID, pa
}
}

func determineErrorMessage(err error) string {
Copy link
Contributor

Choose a reason for hiding this comment

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

This function should not be defined in router package. It should be defined in function package. This is where providers specific logic should live.

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.

3 participants