Closed dmmulroy closed 1 month ago
Latest commit: be9b9b7153a9bec0beaf6ea17c57ec571d15309d
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
Hey @dmmulroy thank you for the first contribution :) ... please provide a changeset file and additionally address the merge conflicts!
Going to close this and reopen with fixes addressed, i made a silly mistake by pushing to my master branch
Pull Request Description
Summary
This PR introduces enhancements to the error handling mechanism within the codebase by allowing custom error messages to be specified. Additionally, it updates the README documentation and adds new test cases.
Changes Made
README.md:
src/_internals/error.ts
:ErrorConfig
interface to include an optionalmessage
property.src/result.ts
:_unsafeUnwrapErr
method in theOk
class to use the custom error message if provided, otherwise, it defaults to the existing message._unsafeUnwrap
method in theErr
class to use the custom error message if provided, otherwise, it defaults to the existing message.tests/index.test.ts
:_unsafeUnwrap
and_unsafeUnwrapErr
are called with a custom message in theOk
andErr
classes.