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

feat(transform): Add Customizable Errors to MetaErr #174

Merged
merged 2 commits into from
May 21, 2024

Conversation

jshlbrd
Copy link
Contributor

@jshlbrd jshlbrd commented May 20, 2024

Description

  • Adds an option to configure which error messages should be caught using the Meta Err transform

Motivation and Context

This transform catches all errors, but there are some cases where only specific errors should be caught while others should crash the application. By default this option is the same as the existing solution, and it matches the behavior used by ErrorMessages elsewhere in the app (https://github.com/brexhq/substation/blob/main/internal/aws/config.go#L96).

How Has This Been Tested?

Added unit test that shows it catching errors when configured.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@jshlbrd jshlbrd marked this pull request as ready for review May 20, 2024 13:50
@jshlbrd jshlbrd requested a review from a team as a code owner May 20, 2024 13:50
Type: "utility_err",
},
"error_messages": []string{
"test error",
Copy link
Contributor

Choose a reason for hiding this comment

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

tests: we should consider adding an additional test with regular expressions in the error _messages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean a regular expression with special characters? These are all regular expressions.

Copy link
Contributor

@shellcromancer shellcromancer May 21, 2024

Choose a reason for hiding this comment

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

Yeah I meant with special characters such as wildcard globs. This way any future refactor or changes in this processor that attempt another approach like strings.Contains(err.Error(), error_message) to do the matching don't regress in functionality.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yep, that's a good idea.

@jshlbrd jshlbrd merged commit 3759ccc into main May 21, 2024
4 checks passed
@jshlbrd jshlbrd deleted the jshlbrd/feat/tf-err-messages branch May 21, 2024 23:07
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.

None yet

2 participants