-
函数
- Abort
- AbortProtect
- ArgumentsOptions
- Assert
- Catch
- CatchExceptions
- Check
- CheckAbort
- CheckArguments
- Condition
- Confirm
- ConfirmAssert
- ConfirmBy
- ConfirmMatch
- ConfirmQuiet
- Echo
- EchoEvaluation
- EchoFunction
- EchoLabel
- EchoTiming
- Enclose
- Exception
- ExceptionQ
- ExceptionTypeRegisteredQ
- ExceptionTypes
- Failsafe
- Failure
- Interrupt
- Missing
- OptionsPattern
- PropagateAborts
- RegisterExceptionType
- TerminatedEvaluation
- Throw
- ThrowException
- WithCleanup
- 相关指南
-
-
函数
- Abort
- AbortProtect
- ArgumentsOptions
- Assert
- Catch
- CatchExceptions
- Check
- CheckAbort
- CheckArguments
- Condition
- Confirm
- ConfirmAssert
- ConfirmBy
- ConfirmMatch
- ConfirmQuiet
- Echo
- EchoEvaluation
- EchoFunction
- EchoLabel
- EchoTiming
- Enclose
- Exception
- ExceptionQ
- ExceptionTypeRegisteredQ
- ExceptionTypes
- Failsafe
- Failure
- Interrupt
- Missing
- OptionsPattern
- PropagateAborts
- RegisterExceptionType
- TerminatedEvaluation
- Throw
- ThrowException
- WithCleanup
- 相关指南
-
函数
鲁棒错误处理
Wolfram 语言提供多种机制来检测和管理错误,并帮助确保程序鲁棒并按预期执行. Confirm 系列函数允许在程序执行期间检查各种形式的错误条件,并在检测到错误时立即中止程序执行. Enclose 定义程序中将捕获错误的范围.
函数参数检查
CheckArguments — 检查函数参数的结构
ArgumentsOptions ▪ OptionsPattern
运行时错误处理
Confirm — 计算表达式,确认没有生成错误
Enclose — 计算表达式,如果失败则停止并返回失败对象
WithCleanup — 即使计算被中断,也运行清理代码
Failsafe — 创建函数可以处理错误输入的版本
确认类型
ConfirmBy — 计算表达式,确认结果满足条件
ConfirmMatch — 计算表达式,确认结果匹配模式
ConfirmQuiet — 计算表达式,确认不生成消息
ConfirmAssert — 确认满足断言
处理异常
ThrowException — 抛出特定类型的异常
CatchExceptions — 捕获并处理指定类型的异常
ExceptionQ — 查看是否为有效的 Exception 对象
ExceptionTypes — 列出所有注册的异常类型
RegisterExceptionType — 注册一个新的符号异常类型
ExceptionTypeRegisteredQ — 检查一个符号是否表示已注册的异常类型
失败表示
Failure ▪ Exception ▪ Missing ▪ $Failed ▪ TerminatedEvaluation
代码监控
Assert — 如果条件不满足则中止
Echo — 打印中间结果
EchoEvaluation ▪ EchoTiming ▪ EchoFunction ▪ EchoLabel
底层错误处理
相关指南
-
▪
- 封装的程序包