【文件属性】:
文件名称:p-catch-if:有条件的承诺捕获处理程序
文件大小:6KB
文件格式:ZIP
更新时间:2021-04-30 20:39:38
JavaScript
p-catch-if
有条件的承诺捕获处理程序
仅用于处理某些类型的错误,让其他错误通过时很有用。
安装
$ npm install p-catch-if
用法
import pCatchIf from 'p-catch-if' ;
// Error constructor
getData ( ) . catch ( pCatchIf ( TimeoutError , ( ) => retry ( getData ) ) ) ;
// Multiple error constructors
getData ( ) . catch ( pCatchIf ( [ NetworkError , TimeoutError ] , ( ) => retry ( getData ) ) ) ;
// Boolean
getData ( ) . catch ( pCatchIf ( isProduct
【文件预览】:
p-catch-if-main
----index.test-d.ts(1KB)
----.gitattributes(19B)
----.github()
--------workflows()
----test.js(3KB)
----license(1KB)
----index.d.ts(2KB)
----.npmrc(19B)
----.editorconfig(175B)
----.gitignore(23B)
----index.js(726B)
----readme.md(2KB)
----package.json(953B)