
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@etop/await-err-handle
Advanced tools
npm i -S @etop/await-err-handle
main.ts 中注册统一的错误处理函数(可选,不注册即没有统一逻辑)import to from '@etop/await-err-handle'
to.prototype.register((err: string | Resp<any>) => {
// 内部逻辑自定义,表示统一的错误处理
// ...
})
例如,将逻辑设置为:优先展示用户自定义的错误信息,没有的话展示后端返回的错误信息,兜底展示 “系统错误”,则写入如下逻辑代码:
import to from '@etop/await-err-handle'
to.prototype.register((err: string | Resp<any>) => {
const msg = (typeof err === 'string' ? err : err.msg) || '系统错误'
Message.error(msg) // 需要导入 element
})
import to from '@etop/await-err-handle'
// ...
// 出错时显示自定义错误信息(会覆盖 register 中设置的错误信息)
const [err1, res1] = await to(asyncFn1(param), '自定义错误信息')
// 出错时什么都不做(不走 register 中函数的逻辑),与不写 register 效果相同
const [err2, res2] = await to(asyncFn2(param), false)
// 出错时显示 register 中配置的默认提示信息
const [err3, res3] = await to(asyncFn3(param))
// ... 对请求结果或错误做处理
FAQs
We found that @etop/await-err-handle demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers 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.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.