@@ -8,7 +8,7 @@ public sealed class ErrorJsonConverter : JsonConverter<Error>
|
||||
{
|
||||
return reader.TokenType switch
|
||||
{
|
||||
JsonTokenType.StartObject => ToExpectedError(ReadOne(ref reader)),
|
||||
JsonTokenType.StartObject => ToExpectedError(ReadOne(ref reader)), // deserialization always produce ExpectedError by design
|
||||
JsonTokenType.StartArray => ReadMany(ref reader),
|
||||
JsonTokenType.None => null,
|
||||
JsonTokenType.Null => null,
|
||||
@@ -42,6 +42,7 @@ public sealed class ErrorJsonConverter : JsonConverter<Error>
|
||||
{
|
||||
errors.Add(ToExpectedError(ReadOne(ref reader)));
|
||||
}
|
||||
else if (reader.TokenType == JsonTokenType.EndArray) break;
|
||||
}
|
||||
return new ManyErrors(errors.ToImmutable());
|
||||
}
|
||||
@@ -73,11 +74,11 @@ public sealed class ErrorJsonConverter : JsonConverter<Error>
|
||||
if (string.IsNullOrEmpty(propvalue))
|
||||
break;
|
||||
|
||||
if (propname == "type" || string.Equals(propname, "type", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (string.Equals(propname, "type", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
type = propvalue;
|
||||
}
|
||||
else if (propname == "msg" || string.Equals(propname, "msg", StringComparison.InvariantCultureIgnoreCase))
|
||||
else if (string.Equals(propname, "msg", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
message = propvalue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user