-
Notifications
You must be signed in to change notification settings - Fork 469
Add optional message
argument to Result.getOrThrow
and improve default error message
#7630
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
base: master
Are you sure you want to change the base?
Add optional message
argument to Result.getOrThrow
and improve default error message
#7630
Conversation
c36f3e7
to
013b234
Compare
013b234
to
e4c07a3
Compare
| Error(_) => throw(Not_found) | ||
| Error(_) => | ||
Stdlib_JsError.panic( | ||
switch message { | ||
| None => "Result.getOrThrow called for Error value" | ||
| Some(message) => message | ||
}, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess technically this is a breaking change. But I don't think we've stopped because of this before (going from exception to general JS error).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a note to the changelog about this breaking change 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a comment from my side. But would be good if someone more took a look at it.
rescript
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/win32-x64
commit: |
This change:
Not_found
thrown byResult.getOrThrow
Option
andResult
by adding an optionalmessage
argument toResult.getOrThrow