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
Sometimes when we want to add a try-catch to a certain asynchronous function, we go from:
let Foo(): Async<'Bar> =
DoSomething()
to:
let Foo(): Async<'Bar> =
try
DoSomething()
with
| ex -> DoSomethingElse()
However, most of the time, the above change is wrong, because the exception only happens when the async job is running, not when the async job is being composed (as it's happening in the above). If we had added the try-with block inside an async{} block, this would have been fine.
Maybe we could create a rule that warns against this, and recommends converting 'Bar to Result<'Bar,'Err> instead.
The text was updated successfully, but these errors were encountered:
Sometimes when we want to add a try-catch to a certain asynchronous function, we go from:
to:
However, most of the time, the above change is wrong, because the exception only happens when the async job is running, not when the async job is being composed (as it's happening in the above). If we had added the try-with block inside an async{} block, this would have been fine.
Maybe we could create a rule that warns against this, and recommends converting 'Bar to Result<'Bar,'Err> instead.
The text was updated successfully, but these errors were encountered: