Custom exceptions
It is possible to create custom exceptions. A custom exception is a custom type:
type
LoadError* = object of Exception
Ending the custom exception’s name with Error is recommended.
Custom exceptions can be raised just like any other exception, e.g.:
raise newException(LoadError, "Failed to load data")
当前内容版权归 nim-lang.org 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 nim-lang.org .