forked from StellarSplit/StellarSplit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi-error-response.dto.ts
More file actions
49 lines (40 loc) · 1.29 KB
/
Copy pathapi-error-response.dto.ts
File metadata and controls
49 lines (40 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
export class ApiErrorResponseDto {
@ApiPropertyOptional({ example: 400 })
statusCode?: number;
@ApiPropertyOptional({ example: 'VALIDATION_ERROR' })
code?: string;
@ApiProperty({
description: 'Human-readable error details or structured validation payload',
oneOf: [
{ type: 'string', example: 'Resource not found' },
{
type: 'array',
items: { type: 'string' },
example: ['format must be one of the supported values'],
},
{
type: 'object',
additionalProperties: true,
example: { message: 'Invitation expired', code: 'INVITE_EXPIRED' },
},
],
})
message!: string | string[] | Record<string, unknown>;
@ApiPropertyOptional({ example: '2026-03-26T19:45:00.000Z' })
timestamp?: string;
@ApiPropertyOptional({ example: '/api/export/create' })
path?: string;
@ApiPropertyOptional({ description: 'Optional correlation ID for tracing' })
correlationId?: string;
@ApiPropertyOptional({ description: 'Optional extra error context' })
details?: unknown;
}
export class UpdatedCountResponseDto {
@ApiProperty({ example: 3 })
updated!: number;
}
export class CountResponseDto {
@ApiProperty({ example: 5 })
count!: number;
}