/** * 通用错误响应 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; }