MCPcopy Create free account
hub / github.com/TRPGEngine/Client / error

Function error

src/web/utils/sentry.ts:47–65  ·  view source on GitHub ↗
(err: Error | string)

Source from the content-addressed store, hash-verified

45 * @param err 错误
46 */
47export async function error(err: Error | string) {
48 initSentry(); // 确保Sentry被初始化
49
50 let fn;
51 if (typeof err === 'string') {
52 fn = Sentry.captureMessage.bind(Sentry);
53 } else {
54 fn = Sentry.captureException.bind(Sentry);
55 }
56 const context: CaptureContext = {
57 contexts: {
58 token: {
59 ...(await getJWTUserInfo()),
60 },
61 },
62 };
63 const sentryId = fn(err, context);
64 console.warn('error: sentryId', sentryId);
65}
66
67/**
68 * 设置用户信息操作

Callers

nothing calls this directly

Calls 2

getJWTUserInfoFunction · 0.90
warnMethod · 0.45

Tested by

no test coverage detected