-
Notifications
You must be signed in to change notification settings - Fork 146
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
feat(idempotency): preserve original error when wrapping into IdempotencyPersistenceLayerError
#1552
feat(idempotency): preserve original error when wrapping into IdempotencyPersistenceLayerError
#1552
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add the same cause
related logic to the before
, after
, and onError
phases of the middleware?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agh, good catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done, I never thought we could add cause
like this!
I left one question about whether or not we should add the same cause
to the middy middleware.
Also I think sometime soon in a separate PR we should look into whether we can support #1361, I tried to print one of the errors with cause (logger.error('An error occurred', err);
) thrown by us in this build and the cause doesn't show anywhere - I think we should support it if possible.
The implementation is naive and since we did not have anything before, I am also open for discussion on alternatives.
I can look into that in a separate PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Description of your changes
We use
IdempotencyPersistenceLayerError
to handle any unknown error that might occur during persistent operations. Examples are IAM permissions, connections, or other configuration issues. Therefore, we need to preserve the original error, so the developer can understand the cause.With this PR we introduce a
cause
that enriches the original error.I have also renamed the error file to align with the recent refactoring of the parameter utility.
Related issues, RFCs
Issue number: closes #1530
Checklist
Breaking change checklist
Is it a breaking change?: NO
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.