File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/FSharpPlus/Extensions Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,13 @@ module Result =
6868 with e -> Error e
6969
7070 /// Gets the 'Ok' value. If it's an 'Error' this function will throw an exception.
71- let get ( source : Result < 'T , 'Error >) = match source with Ok x -> x | _ -> invalidArg " source" " Result value was Error"
71+ let get ( source : Result < 'T , 'Error >) =
72+ match source with
73+ | Ok x -> x
74+ | Error e ->
75+ match box e with
76+ | :? exn as e -> raise <| System.ArgumentException ( " Result value was Error" , " source" , e)
77+ | e -> invalidArg " source" ( " Result value was Error: " + string e)
7278
7379 /// Extracts the Ok value or use the supplied default value when it's an Error.
7480 let defaultValue ( value : 'T ) ( source : Result < 'T , 'Error >) : 'T = match source with Ok v -> v | _ -> value
You can’t perform that action at this time.
0 commit comments