diff --git a/src/ConductorSharp.Client/Service/ConductorClient.cs b/src/ConductorSharp.Client/Service/ConductorClient.cs index bdac763d..f65410c0 100644 --- a/src/ConductorSharp.Client/Service/ConductorClient.cs +++ b/src/ConductorSharp.Client/Service/ConductorClient.cs @@ -44,10 +44,10 @@ private void CheckResponse(RestResponse response) _logger.LogInformation("Received {@Response} with status code {@StatusCode}", response.Content, (int)response.StatusCode); - error = JsonConvert.DeserializeObject(response.Content); + error = response.Content != null ? JsonConvert.DeserializeObject(response.Content) : null; if (error == null || string.IsNullOrEmpty(error.Message)) - throw new Exception("Unable to deserialize error"); + throw new Exception(response.ErrorMessage ?? "Unable to deserialize error"); _logger.LogError("{@conductorError}", error);