internal TranslationError(TranslationErrorCode code, string message, string target, InnerTranslationError innerError) { Code = code; Message = message; Target = target; InnerError = innerError; }
internal TranslationError(TranslationErrorCode code, string message) { if (message == null) { throw new ArgumentNullException(nameof(message)); } Code = code; Message = message; }
internal static TranslationError DeserializeTranslationError(JsonElement element) { TranslationErrorCode code = default; string message = default; Optional <string> target = default; Optional <InnerTranslationError> innerError = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code")) { code = new TranslationErrorCode(property.Value.GetString()); continue; } if (property.NameEquals("message")) { message = property.Value.GetString(); continue; } if (property.NameEquals("target")) { target = property.Value.GetString(); continue; } if (property.NameEquals("innerError")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } innerError = InnerTranslationError.DeserializeInnerTranslationError(property.Value); continue; } } return(new TranslationError(code, message, target.Value, innerError.Value)); }