-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPayloadValidationExceptionDto.cs
More file actions
134 lines (113 loc) · 5.5 KB
/
PayloadValidationExceptionDto.cs
File metadata and controls
134 lines (113 loc) · 5.5 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
namespace Novu.Models.Errors
{
using Newtonsoft.Json;
using Novu.Models.Components;
using Novu.Models.Errors;
using Novu.Utils;
using System;
using System.Collections.Generic;
using System.Net.Http;
public class PayloadValidationExceptionDtoPayload
{
/// <summary>
/// HTTP status code of the error response.
/// </summary>
[JsonProperty("statusCode")]
public double StatusCode { get; set; } = default!;
/// <summary>
/// Timestamp of when the error occurred.
/// </summary>
[JsonProperty("timestamp")]
public string Timestamp { get; set; } = default!;
/// <summary>
/// The path where the error occurred.
/// </summary>
[JsonProperty("path")]
public string Path { get; set; } = default!;
/// <summary>
/// Value that failed validation.
/// </summary>
[JsonProperty("message", NullValueHandling = NullValueHandling.Include)]
public Message? Message { get; set; }
/// <summary>
/// Optional context object for additional error details.
/// </summary>
[JsonProperty("ctx")]
public Dictionary<string, object>? Ctx { get; set; }
/// <summary>
/// Optional unique identifier for the error, useful for tracking using Sentry and <br/>
/// New Relic, only available for 500.
/// </summary>
[JsonProperty("errorId")]
public string? ErrorId { get; set; }
/// <summary>
/// Type identifier for payload validation errors.
/// </summary>
[JsonProperty("type")]
public string Type { get; set; } = default!;
/// <summary>
/// Array of detailed validation errors.
/// </summary>
[JsonProperty("errors")]
public List<PayloadValidationErrorDto> Errors { get; set; } = default!;
/// <summary>
/// The JSON schema that was used for validation.
/// </summary>
[JsonProperty("schema")]
public Schema? Schema { get; set; }
}
public class PayloadValidationExceptionDto : BaseException
{
/// <summary>
/// The original data that was passed to this exception.
/// </summary>
public PayloadValidationExceptionDtoPayload Payload { get; }
[Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use PayloadValidationExceptionDto.Payload.StatusCode instead.")]
public double StatusCode { get; set; } = default!;
[Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use PayloadValidationExceptionDto.Payload.Timestamp instead.")]
public string Timestamp { get; set; } = default!;
[Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use PayloadValidationExceptionDto.Payload.Path instead.")]
public string Path { get; set; } = default!;
[Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use PayloadValidationExceptionDto.Payload.Message instead.")]
public Message? MessageP { get; set; }
[Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use PayloadValidationExceptionDto.Payload.Ctx instead.")]
public Dictionary<string, object>? Ctx { get; set; }
[Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use PayloadValidationExceptionDto.Payload.ErrorId instead.")]
public string? ErrorId { get; set; }
[Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use PayloadValidationExceptionDto.Payload.Type instead.")]
public string Type { get; set; } = default!;
[Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use PayloadValidationExceptionDto.Payload.Errors instead.")]
public List<PayloadValidationErrorDto> Errors { get; set; } = default!;
[Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use PayloadValidationExceptionDto.Payload.Schema instead.")]
public Schema? Schema { get; set; }
public PayloadValidationExceptionDto(
PayloadValidationExceptionDtoPayload payload,
HttpRequestMessage request,
HttpResponseMessage response,
string body
): base("API error occurred", request, response, body)
{
Payload = payload;
#pragma warning disable CS0618
StatusCode = payload.StatusCode;
Timestamp = payload.Timestamp;
Path = payload.Path;
MessageP = payload.Message;
Ctx = payload.Ctx;
ErrorId = payload.ErrorId;
Type = payload.Type;
Errors = payload.Errors;
Schema = payload.Schema;
#pragma warning restore CS0618
}
}
}