@throws (synonyms: @exception)¶
-
.. @throws::
¶ - 同义词
- 语法
@throws 自由形式的描述
@throws {<type>}
@throws {<type>} 自由形式的描述
- 概述
The @throws tag allows you to document an error that a function might throw. You can include the @throws tag more than once in a single JSDoc comment.
- 示例
- Using the @throws tag with a type¶
/** * @throws {InvalidArgumentException} */ function foo(x) {}
Using the @throws tag with a description¶/** * @throws Will throw an error if the argument is null. */ function bar(x) {}
Using the @throws tag with a type and description¶/** * @throws {DivideByZero} Argument x must be non-zero. */ function baz(x) {}