Skip to content

JsonReaderException: not being able to see the response #345

@ZackStone

Description

@ZackStone

Oracle's response is not a JSON, and I'm not able to see its content.
There should be a better way to handle this case.

Error: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
   at Oci.Common.Http.Internal.ResponseHelper.HandleNonSuccessfulResponse(HttpResponseMessage responseMessage, ApiDetails apiDetails, String caller)
   at Oci.Common.Retry.GenericRetrier.ShoulRetryOnHttpResponse(HttpResponseMessage response)
   at Oci.Common.Retry.GenericRetrier.<>c__DisplayClass4_0.<MakeRetryingCall>b__1(HttpResponseMessage r)
   at Polly.PolicyBuilder`1.<>c__DisplayClass14_0.<OrResult>b__0(TResult result)
   at Polly.ResultPredicates`1.<>c__DisplayClass2_0.<AnyMatch>b__0(ResultPredicate`1 predicate)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at Polly.ResultPredicates`1.AnyMatch(TResult result)
   at Polly.Retry.AsyncRetryEngine.<ImplementationAsync>d__0`1.MoveNext()

return JsonConvert.DeserializeObject<T>(content, jsonSerializerSettings);
}
catch (Exception e)
{
logger.Warn($"Failed to parse response body: \n{e.StackTrace}");
// Throw the exception instead of wrapping it with OciException.
// This is to differentiate errors coming from service side and errors from SDK serialization/deserialization.
throw e;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions