Skip to content

Add error code and category funcs#109

Merged
artursouza merged 2 commits into
dapr:mainfrom
jake-engelberg:error-code-cat
Nov 27, 2024
Merged

Add error code and category funcs#109
artursouza merged 2 commits into
dapr:mainfrom
jake-engelberg:error-code-cat

Conversation

@jake-engelberg

Copy link
Copy Markdown
Contributor

Description

In order to support error code metrics, sometimes the category will need to be passed along with a kit error, as well as the ability to retrieve it and its error code.

Issue reference

Please reference the issue this PR will close: dapr/proposals#67

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests

@elena-kolevska elena-kolevska left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you please add a unit test for ErrorCode() ?
Also, if I remember correctly, we should be checking if the tag field has a value first, before checking ErrorInfo.

Comment thread errors/errors.go Outdated
@jake-engelberg

Copy link
Copy Markdown
Contributor Author

Can you please add a unit test for ErrorCode() ? Also, if I remember correctly, we should be checking if the tag field has a value first, before checking ErrorInfo.

Added testing for ErrorCode().

Also, I've added the prioritization of tag in the ErrorCode() method itself rather than the ConvertErrorDetails() method, if you think I should move it in there lmk.

@elena-kolevska elena-kolevska left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great work!
We ended up doing the check for the legacy tag twice (you had it right the first time), but that's ok, I don't want to delay this PR.

@artursouza
artursouza merged commit 30e2c24 into dapr:main Nov 27, 2024
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.

5 participants