# @exodus/sentry-client 中文文档

规范地址：https://npmcn.com/package/%40exodus/sentry-client/

版本：6\.5\.1
npm 元数据更新时间：2026-10-13T17:16:39.138Z
中文译文更新时间：2026-11-14T04:06:51.782Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40exodus/sentry-client
原文对照：https://npmcn.com/package/%40exodus/sentry-client/?lang=original
项目主页：https://github.com/ExodusMovement/exodus/tree/master/libs/libraries/sentry-client
源码仓库：https://github.com/ExodusMovement/exodus

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：27.1 kB，14 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- 运行依赖：3 个
- 首次发布：2023-08-01T17:35:58.347Z
- 最新版本发布：2026-10-13T17:16:38.916Z
- 近 30 天下载量：11388（2026-10-14 至 2026-11-12，npm 官方下载统计）
- 已发布版本数：25（近 12 个月 7 个）

## 中文简介

API 客户端,用于消毒并向 Sentry.io 发送错误

## 安装

```sh
npm install @exodus/sentry-client
```

也可以使用：`pnpm add @exodus/sentry-client`、`yarn add @exodus/sentry-client`、`bun add @exodus/sentry-client`

## README

# @exodus/sentry-客户端

API客户端用于对Sentry.io进行消毒并发送出错.

## 使用量

```js
import createSentryClient from '@exodus/sentry-client'
import { safeString } from '@exodus/safe-string'

const client = createSentryClient({
  fetchival,
  config: {
    // get this from your sentry project page at https://xxxxxx.sentry.io/settings/projects/node/keys/
    // strip the project ID url path from the url they provide
    dsnUrl: 'https://<publicKey>@<someId>.ingest.sentry.io',
    publicKey: '<publicKey>',
    projectId: '<projectId>',
    environment: 'staging',
    // optional
    os: 'ios',
    osVersion: '1.2.3',
    platform: 'test',
    appVersion: '3.2.1',
    jsEngine: 'hermes', // or 'jsc'
  },
})

// Note: all error messages must be safe for logging and should never expose sensitive data.
// Use the `safeString` tag to sanitize any dynamic values (e.g., PII, secrets etc.).
client.captureError({
  // Will be sanitized to: "Failed to send recovery email: <redacted>"
  error: new Error(safeString`Failed to send recovery email: ${email}`),
})
```

### 链接错误

错误 `cause` 链条(深度可达5级)自动被捕获并送往哨兵 作为连锁例外的链条,所以在抛出错误的同时保留了根源.

```js
client.captureError({
  error: new Error(safeString`Failed to sync wallet`, {
    cause: new Error(safeString`Network request failed`),
  }),
})
```

## 常见问题

### @exodus/sentry-client 是什么？

API 客户端,用于消毒并向 Sentry\.io 发送错误

### 如何安装 @exodus/sentry-client？

在项目目录运行 npm install @exodus/sentry-client，或使用 pnpm add / yarn add / bun add。

### @exodus/sentry-client 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @exodus/sentry-client 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @exodus/sentry-client 可以商用吗？

@exodus/sentry-client 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @exodus/sentry-client 的下载量有多少？

根据 npm 官方下载统计，@exodus/sentry-client 在 2026/10/14 – 2026/11/12 这 30 天内被下载 11,388 次，日均约 380 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @exodus/sentry-client 还在维护吗？

最新版本 6\.5\.1 发布于 2026/10/14（1 个月前）；至今共发布 25 个版本，其中过去 12 个月发布了 7 个；首次发布于 2023/08/02。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

