同义词
exception
语法
@throws 自由格式描述
@throws {<type>}
@throws {<type>} 自由格式描述
概述
@throws 标记允许您记录函数可能抛出的错误。您可以在单个 JSDoc 注释中多次包含 @throws 标记。
示例
/**
* @throws {InvalidArgumentException}
*/
function foo(x) {}
/**
* @throws Will throw an error if the argument is null.
*/
function bar(x) {}
/**
* @throws {DivideByZero} Argument x must be non-zero.
*/
function baz(x) {}