Skip to content

Commit

Permalink
Merge pull request #398 from ArangoDB-Community/feature-3.8/DE-251-Nu…
Browse files Browse the repository at this point in the history
…llReferenceException-thrown-on-deserializing-empty-error-content

Solves NullReferenceException thrown when deserializing empty content of error reponse
  • Loading branch information
tjoubert authored Aug 4, 2022
2 parents b930661 + 5f41b12 commit da613bb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion arangodb-net-standard/ApiErrorException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ namespace ArangoDBNetStandard
[Serializable]
public class ApiErrorException : Exception
{
/// <summary>
/// Can be null if ArangoDB returns empty content
/// in the response.
/// </summary>
public ApiErrorResponse ApiError { get; set; }

public ApiErrorException()
{
}

public ApiErrorException(ApiErrorResponse error) : base(error.ErrorMessage)
public ApiErrorException(ApiErrorResponse error) : base(error == null ? string.Empty : error.ErrorMessage)
{
ApiError = error;
}
Expand Down

0 comments on commit da613bb

Please sign in to comment.