File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,7 +13,9 @@ public partial class ApiException : global::System.Exception
1313 /// </summary>
1414 public global ::System . Net . HttpStatusCode StatusCode { get ; }
1515 /// <summary>
16- /// The response body.
16+ /// The response body as a string, or <c>null</c> if the body could not be read.
17+ /// This is always populated for error responses regardless of the <c>ReadResponseAsString</c> setting.
18+ /// For success-path failures (e.g. deserialization errors), the client attempts a best-effort read.
1719 /// </summary>
1820 public string ? ResponseBody { get ; set ; }
1921 /// <summary>
Original file line number Diff line number Diff line change @@ -108,8 +108,9 @@ partial void ProcessCreateAssetResponseContent(
108108 }
109109 else
110110 {
111- var __contentStream_422 = await __response . Content . ReadAsStreamAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
112- __value_422 = await global ::Hedra . HTTPValidationError . FromJsonStreamAsync ( __contentStream_422 , JsonSerializerContext ) . ConfigureAwait ( false ) ;
111+ __content_422 = await __response . Content . ReadAsStringAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
112+
113+ __value_422 = global ::Hedra . HTTPValidationError . FromJson ( __content_422 , JsonSerializerContext ) ;
113114 }
114115 }
115116 catch ( global ::System . Exception __ex )
@@ -189,11 +190,25 @@ partial void ProcessCreateAssetResponseContent(
189190 }
190191 catch ( global ::System . Exception __ex )
191192 {
193+ string ? __content = null ;
194+ try
195+ {
196+ __content = await __response . Content . ReadAsStringAsync (
197+ #if NET5_0_OR_GREATER
198+ cancellationToken
199+ #endif
200+ ) . ConfigureAwait ( false ) ;
201+ }
202+ catch ( global ::System . Exception )
203+ {
204+ }
205+
192206 throw new global ::Hedra . ApiException (
193- message : __response . ReasonPhrase ?? string . Empty ,
207+ message : __content ?? __response . ReasonPhrase ?? string . Empty ,
194208 innerException : __ex ,
195209 statusCode : __response . StatusCode )
196210 {
211+ ResponseBody = __content ,
197212 ResponseHeaders = global ::System . Linq . Enumerable . ToDictionary (
198213 __response . Headers ,
199214 h => h . Key ,
Original file line number Diff line number Diff line change @@ -106,8 +106,9 @@ partial void ProcessGenerateAssetResponseContent(
106106 }
107107 else
108108 {
109- var __contentStream_422 = await __response . Content . ReadAsStreamAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
110- __value_422 = await global ::Hedra . HTTPValidationError . FromJsonStreamAsync ( __contentStream_422 , JsonSerializerContext ) . ConfigureAwait ( false ) ;
109+ __content_422 = await __response . Content . ReadAsStringAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
110+
111+ __value_422 = global ::Hedra . HTTPValidationError . FromJson ( __content_422 , JsonSerializerContext ) ;
111112 }
112113 }
113114 catch ( global ::System . Exception __ex )
@@ -187,11 +188,25 @@ partial void ProcessGenerateAssetResponseContent(
187188 }
188189 catch ( global ::System . Exception __ex )
189190 {
191+ string ? __content = null ;
192+ try
193+ {
194+ __content = await __response . Content . ReadAsStringAsync (
195+ #if NET5_0_OR_GREATER
196+ cancellationToken
197+ #endif
198+ ) . ConfigureAwait ( false ) ;
199+ }
200+ catch ( global ::System . Exception )
201+ {
202+ }
203+
190204 throw new global ::Hedra . ApiException (
191- message : __response . ReasonPhrase ?? string . Empty ,
205+ message : __content ?? __response . ReasonPhrase ?? string . Empty ,
192206 innerException : __ex ,
193207 statusCode : __response . StatusCode )
194208 {
209+ ResponseBody = __content ,
195210 ResponseHeaders = global ::System . Linq . Enumerable . ToDictionary (
196211 __response . Headers ,
197212 h => h . Key ,
Original file line number Diff line number Diff line change @@ -137,11 +137,25 @@ partial void ProcessGetCreditsResponseContent(
137137 }
138138 catch ( global ::System . Exception __ex )
139139 {
140+ string ? __content = null ;
141+ try
142+ {
143+ __content = await __response . Content . ReadAsStringAsync (
144+ #if NET5_0_OR_GREATER
145+ cancellationToken
146+ #endif
147+ ) . ConfigureAwait ( false ) ;
148+ }
149+ catch ( global ::System . Exception )
150+ {
151+ }
152+
140153 throw new global ::Hedra . ApiException (
141- message : __response . ReasonPhrase ?? string . Empty ,
154+ message : __content ?? __response . ReasonPhrase ?? string . Empty ,
142155 innerException : __ex ,
143156 statusCode : __response . StatusCode )
144157 {
158+ ResponseBody = __content ,
145159 ResponseHeaders = global ::System . Linq . Enumerable . ToDictionary (
146160 __response . Headers ,
147161 h => h . Key ,
Original file line number Diff line number Diff line change @@ -99,8 +99,9 @@ partial void ProcessGetStatusResponseContent(
9999 }
100100 else
101101 {
102- var __contentStream_422 = await __response . Content . ReadAsStreamAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
103- __value_422 = await global ::Hedra . HTTPValidationError . FromJsonStreamAsync ( __contentStream_422 , JsonSerializerContext ) . ConfigureAwait ( false ) ;
102+ __content_422 = await __response . Content . ReadAsStringAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
103+
104+ __value_422 = global ::Hedra . HTTPValidationError . FromJson ( __content_422 , JsonSerializerContext ) ;
104105 }
105106 }
106107 catch ( global ::System . Exception __ex )
@@ -180,11 +181,25 @@ partial void ProcessGetStatusResponseContent(
180181 }
181182 catch ( global ::System . Exception __ex )
182183 {
184+ string ? __content = null ;
185+ try
186+ {
187+ __content = await __response . Content . ReadAsStringAsync (
188+ #if NET5_0_OR_GREATER
189+ cancellationToken
190+ #endif
191+ ) . ConfigureAwait ( false ) ;
192+ }
193+ catch ( global ::System . Exception )
194+ {
195+ }
196+
183197 throw new global ::Hedra . ApiException (
184- message : __response . ReasonPhrase ?? string . Empty ,
198+ message : __content ?? __response . ReasonPhrase ?? string . Empty ,
185199 innerException : __ex ,
186200 statusCode : __response . StatusCode )
187201 {
202+ ResponseBody = __content ,
188203 ResponseHeaders = global ::System . Linq . Enumerable . ToDictionary (
189204 __response . Headers ,
190205 h => h . Key ,
Original file line number Diff line number Diff line change @@ -145,8 +145,9 @@ partial void ProcessListResponseContent(
145145 }
146146 else
147147 {
148- var __contentStream_422 = await __response . Content . ReadAsStreamAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
149- __value_422 = await global ::Hedra . HTTPValidationError . FromJsonStreamAsync ( __contentStream_422 , JsonSerializerContext ) . ConfigureAwait ( false ) ;
148+ __content_422 = await __response . Content . ReadAsStringAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
149+
150+ __value_422 = global ::Hedra . HTTPValidationError . FromJson ( __content_422 , JsonSerializerContext ) ;
150151 }
151152 }
152153 catch ( global ::System . Exception __ex )
@@ -226,11 +227,25 @@ partial void ProcessListResponseContent(
226227 }
227228 catch ( global ::System . Exception __ex )
228229 {
230+ string ? __content = null ;
231+ try
232+ {
233+ __content = await __response . Content . ReadAsStringAsync (
234+ #if NET5_0_OR_GREATER
235+ cancellationToken
236+ #endif
237+ ) . ConfigureAwait ( false ) ;
238+ }
239+ catch ( global ::System . Exception )
240+ {
241+ }
242+
229243 throw new global ::Hedra . ApiException (
230- message : __response . ReasonPhrase ?? string . Empty ,
244+ message : __content ?? __response . ReasonPhrase ?? string . Empty ,
231245 innerException : __ex ,
232246 statusCode : __response . StatusCode )
233247 {
248+ ResponseBody = __content ,
234249 ResponseHeaders = global ::System . Linq . Enumerable . ToDictionary (
235250 __response . Headers ,
236251 h => h . Key ,
Original file line number Diff line number Diff line change @@ -109,8 +109,9 @@ partial void ProcessListAssetsResponseContent(
109109 }
110110 else
111111 {
112- var __contentStream_422 = await __response . Content . ReadAsStreamAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
113- __value_422 = await global ::Hedra . HTTPValidationError . FromJsonStreamAsync ( __contentStream_422 , JsonSerializerContext ) . ConfigureAwait ( false ) ;
112+ __content_422 = await __response . Content . ReadAsStringAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
113+
114+ __value_422 = global ::Hedra . HTTPValidationError . FromJson ( __content_422 , JsonSerializerContext ) ;
114115 }
115116 }
116117 catch ( global ::System . Exception __ex )
@@ -190,11 +191,25 @@ partial void ProcessListAssetsResponseContent(
190191 }
191192 catch ( global ::System . Exception __ex )
192193 {
194+ string ? __content = null ;
195+ try
196+ {
197+ __content = await __response . Content . ReadAsStringAsync (
198+ #if NET5_0_OR_GREATER
199+ cancellationToken
200+ #endif
201+ ) . ConfigureAwait ( false ) ;
202+ }
203+ catch ( global ::System . Exception )
204+ {
205+ }
206+
193207 throw new global ::Hedra . ApiException (
194- message : __response . ReasonPhrase ?? string . Empty ,
208+ message : __content ?? __response . ReasonPhrase ?? string . Empty ,
195209 innerException : __ex ,
196210 statusCode : __response . StatusCode )
197211 {
212+ ResponseBody = __content ,
198213 ResponseHeaders = global ::System . Linq . Enumerable . ToDictionary (
199214 __response . Headers ,
200215 h => h . Key ,
Original file line number Diff line number Diff line change @@ -102,8 +102,9 @@ partial void ProcessListModelsResponseContent(
102102 }
103103 else
104104 {
105- var __contentStream_422 = await __response . Content . ReadAsStreamAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
106- __value_422 = await global ::Hedra . HTTPValidationError . FromJsonStreamAsync ( __contentStream_422 , JsonSerializerContext ) . ConfigureAwait ( false ) ;
105+ __content_422 = await __response . Content . ReadAsStringAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
106+
107+ __value_422 = global ::Hedra . HTTPValidationError . FromJson ( __content_422 , JsonSerializerContext ) ;
107108 }
108109 }
109110 catch ( global ::System . Exception __ex )
@@ -183,11 +184,25 @@ partial void ProcessListModelsResponseContent(
183184 }
184185 catch ( global ::System . Exception __ex )
185186 {
187+ string ? __content = null ;
188+ try
189+ {
190+ __content = await __response . Content . ReadAsStringAsync (
191+ #if NET5_0_OR_GREATER
192+ cancellationToken
193+ #endif
194+ ) . ConfigureAwait ( false ) ;
195+ }
196+ catch ( global ::System . Exception )
197+ {
198+ }
199+
186200 throw new global ::Hedra . ApiException (
187- message : __response . ReasonPhrase ?? string . Empty ,
201+ message : __content ?? __response . ReasonPhrase ?? string . Empty ,
188202 innerException : __ex ,
189203 statusCode : __response . StatusCode )
190204 {
205+ ResponseBody = __content ,
191206 ResponseHeaders = global ::System . Linq . Enumerable . ToDictionary (
192207 __response . Headers ,
193208 h => h . Key ,
Original file line number Diff line number Diff line change @@ -137,11 +137,25 @@ partial void ProcessListVoicesResponseContent(
137137 }
138138 catch ( global ::System . Exception __ex )
139139 {
140+ string ? __content = null ;
141+ try
142+ {
143+ __content = await __response . Content . ReadAsStringAsync (
144+ #if NET5_0_OR_GREATER
145+ cancellationToken
146+ #endif
147+ ) . ConfigureAwait ( false ) ;
148+ }
149+ catch ( global ::System . Exception )
150+ {
151+ }
152+
140153 throw new global ::Hedra . ApiException (
141- message : __response . ReasonPhrase ?? string . Empty ,
154+ message : __content ?? __response . ReasonPhrase ?? string . Empty ,
142155 innerException : __ex ,
143156 statusCode : __response . StatusCode )
144157 {
158+ ResponseBody = __content ,
145159 ResponseHeaders = global ::System . Linq . Enumerable . ToDictionary (
146160 __response . Headers ,
147161 h => h . Key ,
Original file line number Diff line number Diff line change @@ -116,8 +116,9 @@ partial void ProcessUploadAssetResponseContent(
116116 }
117117 else
118118 {
119- var __contentStream_422 = await __response . Content . ReadAsStreamAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
120- __value_422 = await global ::Hedra . HTTPValidationError . FromJsonStreamAsync ( __contentStream_422 , JsonSerializerContext ) . ConfigureAwait ( false ) ;
119+ __content_422 = await __response . Content . ReadAsStringAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
120+
121+ __value_422 = global ::Hedra . HTTPValidationError . FromJson ( __content_422 , JsonSerializerContext ) ;
121122 }
122123 }
123124 catch ( global ::System . Exception __ex )
@@ -197,11 +198,25 @@ partial void ProcessUploadAssetResponseContent(
197198 }
198199 catch ( global ::System . Exception __ex )
199200 {
201+ string ? __content = null ;
202+ try
203+ {
204+ __content = await __response . Content . ReadAsStringAsync (
205+ #if NET5_0_OR_GREATER
206+ cancellationToken
207+ #endif
208+ ) . ConfigureAwait ( false ) ;
209+ }
210+ catch ( global ::System . Exception )
211+ {
212+ }
213+
200214 throw new global ::Hedra . ApiException (
201- message : __response . ReasonPhrase ?? string . Empty ,
215+ message : __content ?? __response . ReasonPhrase ?? string . Empty ,
202216 innerException : __ex ,
203217 statusCode : __response . StatusCode )
204218 {
219+ ResponseBody = __content ,
205220 ResponseHeaders = global ::System . Linq . Enumerable . ToDictionary (
206221 __response . Headers ,
207222 h => h . Key ,
You can’t perform that action at this time.
0 commit comments