Files
dukang/server/dukang-api/src/modules/common/dto/client-error.dto.ts
T
jacy 02d89e6385 feat(ops): kb doc edit, validation auto-tickets, support batch ops
Add knowledge document GET/PUT and admin edit UI; auto-create support tickets on client 400 validation errors across user/shop/partner apps; batch create tasks and publish from support tickets; restore mini-user store env single-column layout.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-05 00:08:40 +08:00

50 lines
1.0 KiB
TypeScript

import { IsIn, IsObject, IsOptional, IsString, MaxLength } from 'class-validator';
/** 客户端报错严重级别 */
export const CLIENT_ERROR_LEVELS = ['fatal', 'error', 'warn'] as const;
export type ClientErrorLevel = (typeof CLIENT_ERROR_LEVELS)[number];
/** 客户端报错类别 */
export const CLIENT_ERROR_CATEGORIES = [
'js_error',
'unhandled_rejection',
'api_error',
'validation_error',
'network',
'render',
'bridge',
'other',
] as const;
export type ClientErrorCategory = (typeof CLIENT_ERROR_CATEGORIES)[number];
export class ReportClientErrorDto {
@IsIn(CLIENT_ERROR_LEVELS)
level!: ClientErrorLevel;
@IsIn(CLIENT_ERROR_CATEGORIES)
category!: ClientErrorCategory;
@IsString()
@MaxLength(1000)
message!: string;
@IsOptional()
@IsString()
@MaxLength(4000)
stack?: string;
@IsOptional()
@IsString()
@MaxLength(128)
pagePath?: string;
@IsOptional()
@IsString()
@MaxLength(64)
clientApp?: string;
@IsOptional()
@IsObject()
extra?: Record<string, unknown>;
}