
Security News
PolinRider: North Korea-Linked Supply Chain Campaign Expands Across Open Source Ecosystems
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.
await-catch-loader
Advanced tools
统一处理await形式promise,捕获错误
npm install await-catch-loader -D
太多的try catch注入业务代码,不易于维护
// 使用loader前
async function a() {
console.log('分割线')
await new Promise((resovle, reject) => {
reject('抛出错误')
})
console.log('分割线')
}
// 使用loader后
async function a() {
console.log('分割线')
try {
await new Promise((resovle, reject) => {
reject('抛出错误')
})
} catch(e) {
console.error(e)
}
console.log('分割线')
}
module: {
rules: [{
test: /\.js$/,
use: {
loader: 'await-catch-loader',
options: {
catch:`console.error(e)`,
catchArg: 'e'
}
}
}]
},
| name | type | default | description |
|---|---|---|---|
| catch | string|function | console.error(e) | catch子句中的代码片段 |
| catchArg | string | e | catch子句中的错误对象标识符(如果catch参数类型为函数,并且拥有参数,优先级大于catchArg) |
FAQs
统一处理await形式promise,捕获错误
We found that await-catch-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.

Security News
Open source attacks are accelerating as AI coding agents pull in dependencies faster, with less human review.

Research
/Security News
Malicious Chrome and Firefox extensions posed as free VPNs while stealing clipboard data through later extension updates.