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

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -