When an exception occurs during the deserialization, the Deserialize method will catch it and wrap it inside InvalidOperationException This means that you need to chatch InvalidOperationException and then analyze the InnerException property to get to your user-defined exception.
When an exception occurs during the deserialization, the Deserialize method will catch it and wrap it inside InvalidOperationException. This means that you need to chatch InvalidOperationException and then analyze the InnerException property to get to your user-defined exception. Try // .. with | :?
InvalidOperationException as invOp -> match inv. InnerException with | :? ConfigFileVersionIncompatabilityException as e -> printfn "%s" e.
Data0 | _ -> // generic handler | e -> // generic handler The Data0 property exposes the value carried by the exception (I used it, because you cannot access it easily in the pattern matching when using :? ). However, you can avoid the ugly nesting of match expressions (and the duplication of generic handlers) using active patterns: let (|InnerException|) (e:exn) = e.
InnerException try // .. with | InnerException(ConfigFileVersionIncompatabilityException s) -> printfn "%s" s | _ -> // generic handler.
It works! I really should have caught that the exception was wrapped in another one from the message it displayed. Ah well.
I'll have to look more into active patterns -- I'm still pretty new to F#, though I've worked a bit in Haskell. It seems your 39.2k rep is well deserved, many thanks! – paul Mar 25 at 18:43.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.