【文件属性】:
文件名称:safety-catch:确保您捕获到实际错误而不是编程错误或断言的小模块
文件大小:3KB
文件格式:ZIP
更新时间:2021-07-24 11:39:33
JavaScript
安全捕获
确保您捕捉到实际错误而不是编程错误或断言的小模块。
npm install safety-catch
当您向它传递 SyntaxError、TypeError、AssertionError 和其他内置函数时,在下一个滴答声中触发未处理的错误。
用法
const safetyCatch = require ( 'safety-catch' )
try {
foo . bar ( )
} catch ( err ) {
// Was this a programming mistake and should you crash your program?
// Ask the safety catch
safetyCatch ( err )
console . log ( 'Actual error' )
}
执照
麻省理工学院
【文件预览】:
safety-catch-master
----.gitignore(24B)
----README.md(551B)
----example.js(90B)
----LICENSE(1KB)
----package.json(547B)
----index.js(481B)