diff --git a/src/libs/ModernMT/Generated/ModernMT.Exceptions.g.cs b/src/libs/ModernMT/Generated/ModernMT.Exceptions.g.cs index ac61a01..beb5e5f 100644 --- a/src/libs/ModernMT/Generated/ModernMT.Exceptions.g.cs +++ b/src/libs/ModernMT/Generated/ModernMT.Exceptions.g.cs @@ -20,6 +20,32 @@ public partial class ApiException : global::System.Exception /// public string? ResponseBody { get; set; } + /// + /// Successful HTTP responses that fail during processing put the cause before a bounded body preview. + /// Inspect ResponseBody for the full response; HTTP service-error messages retain their existing format. + /// + public override string Message + { + get + { + if ((int)StatusCode < 200 || (int)StatusCode >= 300 || InnerException == null) + { + return base.Message; + } + + string? path = (InnerException as global::System.Text.Json.JsonException)?.Path; + return "Response processing failed after successful HTTP " + + ((int)StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture) + ": " + + InnerException.GetType().FullName + ": " + BoundDiagnosticText(InnerException.Message) + + (string.IsNullOrEmpty(path) ? string.Empty : " Path: " + BoundDiagnosticText(path, 256)) + + "\nResponse preview: " + BoundDiagnosticText(base.Message); + } + } + + private static string BoundDiagnosticText(string? value, int maximumLength = 512) => + value == null ? string.Empty : + value.Length <= maximumLength ? value : value.Substring(0, maximumLength) + "... [truncated]"; + /// /// The response headers. /// diff --git a/src/libs/ModernMT/Generated/ModernMT.JsonSerializerContext.g.cs b/src/libs/ModernMT/Generated/ModernMT.JsonSerializerContext.g.cs index f6423d1..1793e5c 100644 --- a/src/libs/ModernMT/Generated/ModernMT.JsonSerializerContext.g.cs +++ b/src/libs/ModernMT/Generated/ModernMT.JsonSerializerContext.g.cs @@ -36,6 +36,7 @@ namespace ModernMT #pragma warning restore CS3016 [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::ModernMT.JsonSerializerContextTypes))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List), TypeInfoPropertyName = "SystemCollectionsGeneric_ObjectList")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(string[]))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::ModernMT.TranslateRequest))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(string))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::ModernMT.TranslateRequestPriority), TypeInfoPropertyName = "TranslateRequestPriority2")] diff --git a/src/libs/ModernMT/Generated/ModernMT.JsonSerializerContextTypes.g.cs b/src/libs/ModernMT/Generated/ModernMT.JsonSerializerContextTypes.g.cs index ff10b6d..1279e48 100644 --- a/src/libs/ModernMT/Generated/ModernMT.JsonSerializerContextTypes.g.cs +++ b/src/libs/ModernMT/Generated/ModernMT.JsonSerializerContextTypes.g.cs @@ -25,6 +25,11 @@ public sealed partial class JsonSerializerContextTypes /// public global::System.Collections.Generic.List? ObjectList { get; set; } + /// + /// String arrays used by dynamic JSON option values. + /// + public string[]? StringArray { get; set; } + /// /// ///