Commits

camlspotter committed d66fda5

Coder.Make.result takes Error exception in a nicer way

  • Participants
  • Parent commits 9710239

Comments (0)

Files changed (1)

   let throw e = raise (Error e)
 
   let result f ?trace t = 
-    try `Ok (f ?trace t) with exn -> `Error (Error.Exception exn, t, ~?trace)
+    try `Ok (f ?trace t) with 
+    | Error e -> `Error e
+    | exn -> `Error (Error.Exception exn, t, ~?trace)
 
   let from_Ok = function
     | `Ok v -> v