try-with

F# How to catch all exceptions

核能气质少年 提交于 2021-01-23 06:25:31
问题 I know how to catch specific exceptions as in the following example: let test_zip_archive candidate_zip_archive = let rc = try ZipFile.Open(candidate_zip_archive.ToString(), ZipArchiveMode.Read) |> ignore zip_file_ok with | :? System.IO.InvalidDataException -> not_a_zip_file | :? System.IO.FileNotFoundException -> file_not_found | :? System.NotSupportedException -> unsupported_exception rc I am reading a bunch of articles to see if I can use a generic exception in the with , like a wildcard