我知道如何捕获特定的异常,就像以下示例:
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
我正在阅读一堆文章,看是否可以在 with
中使用通用异常,就像通配符匹配一样。 是否存在这样的构造,如果存在,它是什么?