购物车
登陆 / 注册
微信扫码登陆

推荐手册

@throws

描述: 说明可能会被抛出什么样的错误。

别名:

  • exception

语法

  • @throws free-form description
  • @throws {<type>}
  • @throws {<type>} free-form description

Overview

@throws标签可以让你描述函数可能会抛出的错误。在一个JSDoc注释块中您可以包含多个@throws标签。

例子

例如,在type中使用@throws标签:

/**
 * @throws {InvalidArgumentException}
 */
 function foo(x) {}

例如,在描述中使用@throws标签:

/**
 * @throws Will throw an error if the argument is null.
 */
 function bar(x) {}

例如,在type和描述中使用@throws标签:

/**
 * @throws {DivideByZero} Argument x must be non-zero.
 */
 function baz(x) {}
网站导航
标签地图
学习路径
视频教程
开发软件
旗下子站
php中文网
phpstudy
技术文章
文档工具
关于我们
企业合作
人才招聘
联系我们
讲师招募
QQ交流群
QQ官方交流群
微信公众号
微信公众号