@error-reporting/node
v0.2.0
Published
Error Reporting Platform SDK for Node.js
Readme
@error-reporting/node
npm install @error-reporting/nodeimport { Init, CaptureException, Flush } from '@error-reporting/node'
Init({ dsn: process.env.ERROR_REPORTING_DSN, environment: 'production', release: 'git-sha' })
CaptureException(new Error('上报接入测试'), { requestId: 'request-42' })
await Flush()在业务模块加载前调用一次 Init。SDK 自动捕获进程内未处理异常,并通过 CaptureException 补报已处理的异常。短脚本或进程退出前可用 Flush(timeoutMs) 等待发送。
从 0.1.x 升级到 0.2.x 时,把三个入口替换成示例中的大写开头写法。
