openapi-connected-service
openapi-connected-service copied to clipboard
Question: SwaggerException with TResult
How do I get the return object from throw new SwaggerException (...) using TResult? I need the deserialized object in return
My error and success return objects are of the same type
For example, in this way?
try
{
}
catch (SwaggerException ex)
{
//if (ex.StatusCode != 200) // you can check statusCode
return JsonConvert.DeserializeObject<TResult>(ex.Response, new JsonSerializerSettings());
}
or
try
{
}
catch (SwaggerException<TResult> ex)
{
//if (ex.StatusCode != 200) // you can check statusCode
return ex.Result;
}