构造一个由于开发人员错误而抛出的异常对象,例如参数无效、参数超出范围等。此异常只能在开发期间抛出;它通常表明调用代码中存在错误。这个异常不应该被捕获;相反,调用代码应该努力不生成它。 Constructs an exception object that is thrown due to a developer error, e.g., invalid argument, argument out of range, etc. This exception should only be thrown during development; it usually indicates a bug in the calling code. This exception should never be caught; instead the calling code should strive not to generate it.
另一方面,一个 On the other hand, a
另一方面,一个 On the other hand, a
RuntimeError 指示可能在运行时引发的异常,例如内存不足,调用代码应准备好捕获该异常。 indicates an exception that may be thrown at runtime, e.g., out of memory, that the calling code should be prepared to catch.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
message |
string | 可选 optional 此异常的错误消息。 The error message for this exception. |
另见: See:
继承 Extends
- Error
成员 Members
抛出此异常的原因的解释。 The explanation for why this exception was thrown.
“DeveloperError”表示由于开发人员错误而引发此异常。 'DeveloperError' indicating that this exception was thrown due to a developer error.
此异常的堆栈跟踪(如果有)。 The stack trace of this exception, if available.
