You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Alternatively, I would like to suggest not using exceptions for WIT results and instead directly returning the Result<Ok, Err>.
Using features like [MemberNotNullWhen] this could also be very ergonomic in my opinion.
It would also prevent users from accidentally throwing errors that the current function can't actually return.
Alternatively, I would like to suggest not using exceptions for WIT results and instead directly returning the Result<Ok, Err>. Using features like [MemberNotNullWhen] this could also be very ergonomic in my opinion. It would also prevent users from accidentally throwing errors that the current function can't actually return.
That's how it used to work prior to #968. I think both approaches have merit, and I'd suggest providing an option to allow the user to choose at binding generation time, with some reasonable default if not otherwise specified.
The pattern where the user code needs to correctly guess type of the
ex.Value
is fragile.The cast here could throw invalid cast exception or could give misleading information.
Should we generate
WitHeaderException
and make the conversion on behalf of the user ?cc @jsturtevant @dicej
The text was updated successfully, but these errors were encountered: