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

chore: add interface for all error response types #434

Merged
merged 2 commits into from
May 2, 2023

Conversation

malandis
Copy link
Contributor

@malandis malandis commented May 2, 2023

In the current formulation, downstream code cannot consume a generic
Error type, because current error types inherit from a parent
abstract class.

This PR introduces an error interface, IError, which specifies that
an error response has the following properties:

  • InnerException
  • ErrorCode
  • Message

which is common to all error classes.

With this in place we inherit the documentation from the interface,
simplifying the doc strings in the response classes.

Eventually we should the same for Success, Hit, and Miss.

closes #433

In the current formulation, downstream code cannot consume a generic
`Error` type, because current error types inherit from a parent
abstract class.

This PR introduces an error interface, `IError`, which specifies that
an error response has the following properties:
- `InnerException`
- `ErrorCode`
- `Message`

which is common to all error classes.

With this in place we inherit the documentation from the interface,
simplifying the doc strings in the response classes.
@malandis malandis marked this pull request as ready for review May 2, 2023 00:17
@@ -43,19 +43,19 @@ public Error(SdkException error)
_error = error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="InnerException"]/*' />
/// <inheritdoc />
Copy link
Member

Choose a reason for hiding this comment

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

doc inheritance 👍 😎

Copy link
Contributor

@cprice404 cprice404 left a comment

Choose a reason for hiding this comment

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

surprised we didn't have this already, thank you

@malandis malandis merged commit c698107 into main May 2, 2023
@malandis malandis deleted the chore/error-interface branch May 2, 2023 01:09
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.

Error types should implement a common interface
3 participants