Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,80 @@ partial void ProcessSpeechResponseContent(
h => h.Key,
h => h.Value));
}
// The referenced resource does not exist or is not visible to the caller's workspace.
if ((int)__response.StatusCode == 404)
{
string? __content_404 = null;
global::System.Exception? __exception_404 = null;
global::Speechify.TtsError? __value_404 = null;
try
{
if (__effectiveReadResponseAsString)
{
__content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
__value_404 = global::Speechify.TtsError.FromJson(__content_404, JsonSerializerContext);
}
else
{
__content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);

__value_404 = global::Speechify.TtsError.FromJson(__content_404, JsonSerializerContext);
}
}
catch (global::System.Exception __ex)
{
__exception_404 = __ex;
}


throw global::Speechify.ApiException<global::Speechify.TtsError>.Create(
statusCode: __response.StatusCode,
message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
innerException: __exception_404,
responseBody: __content_404,
responseObject: __value_404,
responseHeaders: global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value));
}
// Rate limit or concurrency limit exceeded. The response may include a `Retry-After` header.
if ((int)__response.StatusCode == 429)
{
string? __content_429 = null;
global::System.Exception? __exception_429 = null;
global::Speechify.TtsError? __value_429 = null;
try
{
if (__effectiveReadResponseAsString)
{
__content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
__value_429 = global::Speechify.TtsError.FromJson(__content_429, JsonSerializerContext);
}
else
{
__content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);

__value_429 = global::Speechify.TtsError.FromJson(__content_429, JsonSerializerContext);
}
}
catch (global::System.Exception __ex)
{
__exception_429 = __ex;
}


throw global::Speechify.ApiException<global::Speechify.TtsError>.Create(
statusCode: __response.StatusCode,
message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
innerException: __exception_429,
responseBody: __content_429,
responseObject: __value_429,
responseHeaders: global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value));
}
// An unexpected server-side error occurred. Safe to retry with exponential backoff for idempotent requests.
if ((int)__response.StatusCode == 500)
{
Expand Down Expand Up @@ -526,6 +600,80 @@ partial void ProcessSpeechResponseContent(
h => h.Key,
h => h.Value));
}
// An upstream dependency (the TTS composer or voice-metadata service) returned a 5xx. The raw upstream detail is not forwarded - the cause is in the server log; the response is a fixed `upstream_failure` envelope. Safe to retry.
if ((int)__response.StatusCode == 502)
{
string? __content_502 = null;
global::System.Exception? __exception_502 = null;
global::Speechify.TtsError? __value_502 = null;
try
{
if (__effectiveReadResponseAsString)
{
__content_502 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
__value_502 = global::Speechify.TtsError.FromJson(__content_502, JsonSerializerContext);
}
else
{
__content_502 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);

__value_502 = global::Speechify.TtsError.FromJson(__content_502, JsonSerializerContext);
}
}
catch (global::System.Exception __ex)
{
__exception_502 = __ex;
}


throw global::Speechify.ApiException<global::Speechify.TtsError>.Create(
statusCode: __response.StatusCode,
message: __content_502 ?? __response.ReasonPhrase ?? string.Empty,
innerException: __exception_502,
responseBody: __content_502,
responseObject: __value_502,
responseHeaders: global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value));
}
// A downstream dependency is degraded or the endpoint is intentionally disabled (e.g. phone-number purchase before ops setup).
if ((int)__response.StatusCode == 503)
{
string? __content_503 = null;
global::System.Exception? __exception_503 = null;
global::Speechify.TtsError? __value_503 = null;
try
{
if (__effectiveReadResponseAsString)
{
__content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
__value_503 = global::Speechify.TtsError.FromJson(__content_503, JsonSerializerContext);
}
else
{
__content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);

__value_503 = global::Speechify.TtsError.FromJson(__content_503, JsonSerializerContext);
}
}
catch (global::System.Exception __ex)
{
__exception_503 = __ex;
}


throw global::Speechify.ApiException<global::Speechify.TtsError>.Create(
statusCode: __response.StatusCode,
message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
innerException: __exception_503,
responseBody: __content_503,
responseObject: __value_503,
responseHeaders: global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value));
}

if (__effectiveReadResponseAsString)
{
Expand Down
Loading