hard-rejection:使未处理的承诺拒绝立即失败,而不是默认的静默失败

时间:2021-05-26 07:52:18
【文件属性】:
文件名称:hard-rejection:使未处理的承诺拒绝立即失败,而不是默认的静默失败
文件大小:7KB
文件格式:ZIP
更新时间:2021-05-26 07:52:18
JavaScript 坚决拒绝 使未处理的承诺拒绝立即失败,而不是默认的 如果您不附加.catch()处理函数,则承诺会静默失败。 当遇到未处理的拒绝时,此模块立即退出并显示一条错误消息。 注意:这可能是不希望的,因为未处理的拒绝可以进行,尽管并不常见。 您已被警告。 适用于服务器等*长期运行的进程,但不可用于可重用模块中。 有关命令行应用程序和测试,请参见 。 使用,该程序包是默认行为,随后将引发未处理的拒绝。 安装 $ npm install hard-rejection 用法 const hardRejection = require ( 'hard-rejection' ) ; const promiseFunction = require ( 'some-promise-fn' ) ; // Install the handler hardRejection ( ) ; promiseFu
【文件预览】:
hard-rejection-main
----.gitignore(23B)
----fixture-custom-log.js(156B)
----package.json(805B)
----.npmrc(19B)
----index.js(500B)
----test.js(387B)
----.github()
--------workflows()
--------funding.yml(91B)
----license(1KB)
----readme.md(2KB)
----index.test-d.ts(172B)
----fixture.js(107B)
----.gitattributes(19B)
----.editorconfig(175B)
----index.d.ts(601B)
----register.js(30B)

网友评论