Commit 25047073 by luoqi

chore(debug): 加 Sentry 验收端点 /health/sentry-test(PAC_SENTRY_DEBUG=1 才抛)

默认返回提示 JSON(不抛),避免公网裸 500;验收 Sentry 后端捕获用,关 flag 即停。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
parent 1a2b029e
Pipeline #3387 failed in 0 seconds
...@@ -10,4 +10,17 @@ export class HealthController { ...@@ -10,4 +10,17 @@ export class HealthController {
health() { health() {
return { status: 'ok', timestamp: new Date().toISOString() }; return { status: 'ok', timestamp: new Date().toISOString() };
} }
/**
* Sentry 验收端点 —— 仅当 PAC_SENTRY_DEBUG=1 时抛未捕获错误(→ 500 → Sentry captureException)。
* 默认关闭(返回提示 JSON),避免公网留一个裸 500 端点被滥用;验收后把 flag 关掉即可。
*/
@Public()
@Get('sentry-test')
sentryTest() {
if (process.env.PAC_SENTRY_DEBUG !== '1') {
return { enabled: false, hint: '设 PAC_SENTRY_DEBUG=1 后本端点会抛未捕获错误,用于验证 Sentry' };
}
throw new Error('PAC 后端真实错误验收 · Sentry 冒烟(可忽略/删除)');
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment