File tree Expand file tree Collapse file tree 1 file changed +13
-20
lines changed
src/Insurello.RabbitMqClient Expand file tree Collapse file tree 1 file changed +13
-20
lines changed Original file line number Diff line number Diff line change @@ -558,28 +558,21 @@ module MqClient =
558558 fun logError onReceived ->
559559 { OnReceived =
560560 fun message ->
561- onReceived message
562- |> Async.Catch
563- |> Async.map ( function
564- | Choice1Of2 _ -> ()
565- | Choice2Of2 err ->
566- logError ( err, ( sprintf " 💥 Unexpected error. %A \n Shutting down" err), ())
567-
568- exit 2 )
561+ // Somthing weird happens with exception handeling when not
562+ // using Async computational expression. Some exepctions are
563+ // silenty swollowed and never bubbles up.
564+ async {
565+ try
566+ do ! onReceived message
567+ with exn ->
568+ logError ( exn, ( sprintf " 💥 Unexpected error. %A \n Shutting down" exn), ())
569+ exit 2
570+ }
569571
570572 OnRegistered = fun _ -> Async.singleton ()
571573
572- OnUnregistered =
573- fun _ ->
574- failwith " Got OnUnregistered event"
575- Async.singleton ()
574+ OnUnregistered = fun _ -> failwith " Got OnUnregistered event"
576575
577- OnConsumerCancelled =
578- fun _ ->
579- failwith " Got OnConsumerCancelled event"
580- Async.singleton ()
576+ OnConsumerCancelled = fun _ -> failwith " Got OnConsumerCancelled event"
581577
582- OnShutdown =
583- fun _ ->
584- failwith " Got OnShutdown event"
585- Async.singleton () }
578+ OnShutdown = fun _ -> failwith " Got OnShutdown event" }
You can’t perform that action at this time.
0 commit comments