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/error handling #39

Merged
merged 2 commits into from
Feb 10, 2023
Merged

Refactor/error handling #39

merged 2 commits into from
Feb 10, 2023

Conversation

boyswan
Copy link
Contributor

@boyswan boyswan commented Jan 20, 2023

Keep RMRK errors intact rather than downcasting to Strings and wrapping in PSP34::Custom.

  • Clear distinction between true PSP34 and RMRK errors
  • Removes a lot of error boilerplate code
  • Human readable logs in tests (Custom(String) prints as an encoded value)

@Maar-io made a good point about PSP34 potentially being a common interface between external contracts, so having our own error type produces are larger API surface area to cover. One way to manage this is to also provide a From<Error> for PSP34Error to allow easy conversions if necessary.

@boyswan boyswan marked this pull request as ready for review January 20, 2023 22:11
Copy link
Contributor

@Maar-io Maar-io left a comment

Choose a reason for hiding this comment

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

It is much more readable! Thanks for this PR
LGTM

@boyswan boyswan merged commit d37dcdd into main Feb 10, 2023
@boyswan boyswan deleted the refactor/error-handling branch February 10, 2023 16:57
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.

2 participants