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: Hydrate CustomError and Result. #344

Merged
merged 13 commits into from Feb 22, 2022
Merged

Conversation

yeldiRium
Copy link
Contributor

@yeldiRium yeldiRium commented Oct 15, 2021

RFC @dotKuro @goloroden @strangedev

As discussed with @strangedev via slack, I needed a way to hydrate Errors and Results that were JSON-serialized before. That means multiple things:

  • custom JSON serialization for Errors, since native Errors have the worst JSON serialization (namely none)
  • hydration of Results from basically arbitrary data, since a Result<undefined, ...> is represented in JSON as an empty object

Please take a look at the implementations and the documentation and reasoning for them and leave some feedback on wether you think this solution makes sense. Until I get some feedback I'll leave this as a draft.

Copy link
Member

@goloroden goloroden left a comment

Choose a reason for hiding this comment

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

Hey @yeldiRium 👋

I finally had the time to review your changes. Please find my notes inline 😊

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
lib/CustomError.ts Show resolved Hide resolved
@yeldiRium yeldiRium marked this pull request as ready for review January 10, 2022 07:06
Copy link

@strangedev strangedev left a comment

Choose a reason for hiding this comment

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

Nice work, I like the idea. I have some questions regarding the details though, if you could please take a look @yeldiRium 🙂

lib/CustomError.ts Show resolved Hide resolved
README.md Show resolved Hide resolved
lib/hydrateCustomError.ts Outdated Show resolved Hide resolved
lib/hydrateCustomError.ts Outdated Show resolved Hide resolved
lib/hydrateResult.ts Outdated Show resolved Hide resolved
test/unit/hydrateResultTests.ts Outdated Show resolved Hide resolved
test/unit/hydrateResultTests.ts Outdated Show resolved Hide resolved
lib/hydrateResult.ts Outdated Show resolved Hide resolved
test/unit/hydrateResultTests.ts Show resolved Hide resolved
test/unit/hydrateResultTests.ts Show resolved Hide resolved
Copy link

@strangedev strangedev left a comment

Choose a reason for hiding this comment

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

:shipit:

@yeldiRium yeldiRium merged commit 3f4343c into main Feb 22, 2022
@yeldiRium yeldiRium deleted the feat/hydrate-error-and-result branch February 22, 2022 12:12
goloroden pushed a commit that referenced this pull request Feb 22, 2022
# [8.2.0](8.1.0...8.2.0) (2022-02-22)

### Features

* Hydrate CustomError and Result. ([#344](#344)) ([3f4343c](3f4343c))
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

3 participants