c# to f# - f# handling exceptions for multiple exception types -


i trying catch exceptions based on exception type in c#, getting compiler error when following this type test or downcast always @ line | :? system.exception genericexception -> can not have multiple "catch" blocks in f#?

try     ...... | :? system.aggregateexception aggregateexception ->    innerexception in aggregateexception.innerexceptions                 log message | :? system.exception genericexception ->            log message 

it's because :? system.exception as redundant, , code can reduced following:

try     // ... | :? system.aggregateexception aggregateexception ->     innerexception in aggregateexception.innerexceptions         log message | genericexception -> log message 

see answer further examples: how catch exception (system.exception) without warning in f#?


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -