Synonyms
exception
语法
¥Syntax
-
@throws free-form description
-
@throws {<type>}
-
@throws {<type>} free-form description
概述
¥Overview
@throws 标签允许你记录函数可能抛出的错误。你可以在单个 JSDoc 注释中多次包含 @throws 标记。
¥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.
示例
¥Examples
/**
* @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) {}