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

refactor(sdk): implement error interface for MessageError #1270

Merged
merged 2 commits into from
Jan 18, 2023

Conversation

marcpfuller
Copy link
Contributor

Closes: #1125

Signed-off-by: Marc-Philippe Fuller [email protected]

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/app-functions-sdk-go/blob/main/.github/CONTRIBUTING.md

PR Checklist

Please check if your PR fulfills the following requirements:

  • I am not introducing a breaking change (if you are, flag in conventional commit message with BREAKING CHANGE: describing the break)
  • I am not introducing a new dependency (add notes below if you are)
  • I have added unit tests for the new feature or bug fix (if not, why?)
  • I have fully tested (add details below) this the new feature or bug fix (if not, why?)
  • I have opened a PR for the related docs change (if not, why?)

Testing Instructions

make test

New Dependency Instructions (If applicable)

@marcpfuller marcpfuller force-pushed the messageError_interface branch from 5c92b9b to d8ea12a Compare January 17, 2023 20:00
@@ -269,8 +269,8 @@ func TestProcessMessageTransformError(t *testing.T) {
msgErr := runtime.ProcessMessage(context, messageData, runtime.GetDefaultPipeline())

require.NotNil(t, msgErr, "Expected an error")
Copy link
Member

Choose a reason for hiding this comment

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

This one can now be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

require.NotNil has been removed

@@ -449,7 +449,7 @@ func TestDecode_Process_MessageTargetType(t *testing.T) {
targetData, err, _ := runtime.DecodeMessage(context, envelope)
if currentTest.ErrorExpected {
assert.NotNil(t, err, fmt.Sprintf("expected an error for test '%s'", currentTest.Name))
Copy link
Member

Choose a reason for hiding this comment

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

This one can now be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

assert.NotNil has been removed

@@ -82,6 +82,10 @@ type MessageError struct {
ErrorCode int
}

func (merr *MessageError) Error() string {
Copy link
Member

Choose a reason for hiding this comment

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

Perfect!

Signed-off-by: Marc-Philippe Fuller <[email protected]>
Copy link
Member

@lenny-goodell lenny-goodell left a comment

Choose a reason for hiding this comment

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

LGTM

@lenny-goodell lenny-goodell merged commit 4d6f96c into edgexfoundry:main Jan 18, 2023
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.

Enhance MessageError to implement the Error interface
2 participants