【发布时间】:2015-05-15 18:12:34
【问题描述】:
我正在尝试根据异常类型(如 c#)捕获异常,但是当我执行以下操作时出现编译器错误
This type test or downcast will always 在线| :? System.Exception as genericException ->
F# 中不能有多个“catch”块吗?
try
......
with
| :? System.AggregateException as aggregateException ->
for innerException in aggregateException.InnerExceptions do
log message
| :? System.Exception as genericException ->
log message
【问题讨论】:
-
我认为你不需要显式类型测试,最后一个子句可以是
| genericException -> log message