chore: replace all cn comments of fe to en version by volc api (#320)

This commit is contained in:
tecvan
2025-07-31 10:32:15 +08:00
committed by GitHub
parent 716ec0cba8
commit 71f6245a01
2960 changed files with 15545 additions and 15545 deletions

View File

@@ -68,18 +68,18 @@ const handleCertainError: (error: Error) => void = error => {
return;
}
// 上报到自定义错误
// Report a custom error
if (errorName === 'CustomError') {
const { eventName, msg } = error as CustomError;
// 补充统一上报custom error event_name 用于监控
// Supplement unified reporting custom error event_name for monitoring
loggerWithScope.persist.error({
eventName: ReportEventNames.CustomErrorReport,
message: msg,
error,
meta: {
name: error.name,
originEventName: eventName, // 原始originEventName
originErrorMessage: msg, // 原始 error msg
originEventName: eventName, // originEventName
originErrorMessage: msg, // Original error msg
},
});
loggerWithScope.persist.error({
@@ -93,12 +93,12 @@ const handleCertainError: (error: Error) => void = error => {
return;
}
// 滤除已经上报到自定义事件
// Filter out custom events that have been reported
if (errorName === 'ApiError' || errorName === 'AxiosError') {
return;
}
// ChunkLoad 失败, 不上报在slardar 静态资源异常统计
// ChunkLoad failed, not reported, static resource exception statistics in slardar
if (errorName === 'ChunkLoadError') {
reporter.info({
message: 'chunkLoadError',
@@ -112,7 +112,7 @@ const handleCertainError: (error: Error) => void = error => {
return;
}
// 不继承 Error 的错误,目前 casesemi 表单校验
// Error that does not inherit Error, current case (semi form validation)
if (errorName === 'notInstanceError') {
let errorInfo;
try {

View File

@@ -16,23 +16,23 @@
export enum ReportEventNames {
/**
* 通用异常错误
* generic exception error
*/
ChunkLoadError = 'chunk_load_error', // webpack chunk load 失败
Unhandledrejection = 'unhandledrejection', // 异步错误兜底
GlobalErrorBoundary = 'global_error_boundary', // 全局的errorBoundary 错误
ChunkLoadError = 'chunk_load_error', // Webpack chunk load failed
Unhandledrejection = 'unhandledrejection', // Asynchronous Error Bottom Line
GlobalErrorBoundary = 'global_error_boundary', // Global errorBoundary error
NotInstanceError = 'notInstanceError',
CustomErrorReport = 'custom_error_report', // 统一上报的custom error
CustomErrorReport = 'custom_error_report', // Uniformly reported customs errors
}
/**
* 获取已经明确的错误
* Get the error that has been identified
*
* 1CustomError: 业务方 throw new CustomError(ReportEventNames.xxx, 'xxx')
* 2AxiosError: 状态码非 2xx;
* 3ApiError: 状态码 2xx & 业务code == 0
* 4ChunkLoadError: webpack chunk load 失败
* 5notInstanceError,不继承 Error 的错误,目前 casesemi 表单校验
* 1. CustomError: The business party throws new CustomError (ReportEventNames.xxx, 'xxx')
* 2. AxiosError: The status code is not 2xx;
* 3, ApiError: status code 2xx & business code! == 0
* 4. ChunkLoadError: webpack chunk load failed
* 5. notInstanceError, error that does not inherit Error, the current case (semi form verification)
*/
export type CertainErrorName =
| 'CustomError'

View File

@@ -30,7 +30,7 @@ export class CustomError extends Error {
this.ext = ext;
}
}
// sladar beforeSend捕获到的错误需要通过.name判断错误类型
// sladar beforeSend The captured error needs to determine the error type by .name.
export const isCustomError = (error: unknown): error is CustomError =>
error instanceof CustomError ||
(error as CustomError)?.name === 'CustomError';

View File

@@ -61,7 +61,7 @@ export const useErrorCatch = (slardarInstance: SlardarInstance) => {
};
}, []);
// 3. 拦截 slardar 上报
// 3. Interception of slardar reports
useEffect(() => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const beforeSlardarSend = (e: any) => {

View File

@@ -31,7 +31,7 @@ const loggerWithScope = logger.createLoggerWith({
export const useRouteErrorCatch = (error: unknown) => {
useEffect(() => {
if (error) {
// 处理不是error实例的情况
// Handling cases that are not instances of error
const realError =
error instanceof Error
? error
@@ -39,7 +39,7 @@ export const useRouteErrorCatch = (error: unknown) => {
ReportEventNames.GlobalErrorBoundary,
`global error route catch error infos:${String(error)}`,
);
// 过滤 其他error
// Filtering, other errors
sendCertainError(realError, () => {
loggerWithScope.persist.error({
eventName: ReportEventNames.GlobalErrorBoundary,