我试图在try catch中包含简单的语句。问题是我能够找到的所有示例都谈到了预定义的错误。
我需要一个通用错误,类似于C#中的try / catch。
答案 0 :(得分:2)
对于通用的try catch,你可以这样做:
try
...put some code here
catch
...do something for ANY exception here.
finally
...code here that runs IF an exception occurs
end try
catch部分有可选参数来捕获某些类型的错误(你见过的例子)。第一段给出了http://docs.xojo.com/index.php/Try
的定义Try
// Your code
Catch [ErrorParameter] [As ErrorType]
//exception handlers
[ Finally ]
//code that executes even if runtime exceptions were raised
End [Try]