Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Item Operations: Fixes JsonSerialization exception when MissingMemberHandling = Error on Json default settings when NotFound on Item operations. #4125

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ internal static (Error, string) GetErrorFromStream(
using (StreamReader streamReader = new StreamReader(content))
{
string errorContent = streamReader.ReadToEnd();

try
{
JObject errorObj = JObject.Parse(errorContent);
Expand All @@ -179,7 +180,7 @@ internal static (Error, string) GetErrorFromStream(
return (error, message.ToString());
}
}
catch (Newtonsoft.Json.JsonReaderException)
catch (Exception exception) when (CosmosExceptionFactory.ExceptionsToIgnore(exception))
philipthomas-MSFT marked this conversation as resolved.
Show resolved Hide resolved
{
}

Expand All @@ -193,6 +194,12 @@ internal static (Error, string) GetErrorFromStream(
}
}

private static bool ExceptionsToIgnore(Exception exception)
{
return exception is Newtonsoft.Json.JsonReaderException ||
exception is Newtonsoft.Json.JsonSerializationException;
}

internal static CosmosException CreateRequestTimeoutException(
string message,
Headers headers,
Expand Down
Loading
Loading