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 @@ -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))
{
}

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