Files
whale-town-end/src/business/shared/dto/error-response.dto.ts
moyin 47a738067a feat: 重构业务模块架构
- 新增auth模块处理认证逻辑
- 新增security模块处理安全相关功能
- 新增user-mgmt模块管理用户相关操作
- 新增shared模块存放共享组件
- 重构admin模块,添加DTO和Guards
- 为admin模块添加测试文件结构
2025-12-24 18:04:30 +08:00

56 lines
1008 B
TypeScript

/**
* 通用错误响应 DTO
*
* 功能描述:
* - 定义统一的错误响应格式
* - 提供 Swagger 文档生成支持
*
* @author angjustinl
* @version 1.0.0
* @since 2025-12-17
*/
import { ApiProperty } from '@nestjs/swagger';
/**
* 通用错误响应 DTO
*/
export class ErrorResponseDto {
@ApiProperty({
description: 'HTTP 状态码',
example: 500,
type: Number
})
statusCode: number;
@ApiProperty({
description: '错误消息',
example: 'Internal server error',
type: String
})
message: string;
@ApiProperty({
description: '错误发生时间',
example: '2025-12-17T15:00:00.000Z',
type: String,
format: 'date-time'
})
timestamp: string;
@ApiProperty({
description: '请求路径',
example: '/api/status',
type: String,
required: false
})
path?: string;
@ApiProperty({
description: '错误代码',
example: 'INTERNAL_ERROR',
type: String,
required: false
})
error?: string;
}