Skip to content
This repository was archived by the owner on May 16, 2020. It is now read-only.

Commit ce5dd51

Browse files
committed
throw exception if aql query fails
1 parent 1371243 commit ce5dd51

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

src/BorderEast.ArangoDB.Client/BorderEast.ArangoDB.Client/BorderEast.ArangoDB.Client.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3+
<PropertyGroup Label="Globals">
4+
<SccProjectName>SAK</SccProjectName>
5+
<SccProvider>SAK</SccProvider>
6+
<SccAuxPath>SAK</SccAuxPath>
7+
<SccLocalPath>SAK</SccLocalPath>
8+
</PropertyGroup>
9+
310
<PropertyGroup>
411
<TargetFramework>netcoreapp2.0</TargetFramework>
512
<PackageId>BorderEast.ArangoDB.Client</PackageId>

src/BorderEast.ArangoDB.Client/BorderEast.ArangoDB.Client/Database/ArangoQuery.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Text;
88
using System.Threading.Tasks;
99
using System.Linq;
10+
using BorderEast.ArangoDB.Client.Exception;
1011

1112
namespace BorderEast.ArangoDB.Client.Database
1213
{
@@ -81,6 +82,10 @@ public async Task<List<T>> ToListAsync() {
8182
}
8283

8384
var json = JsonConvert.DeserializeObject<AQLResult<T>>(result.Content);
85+
86+
if (json.Error)
87+
throw new QueryExecutionException(json.ErrorMessage);
88+
8489
return json.Result;
8590
}
8691

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace BorderEast.ArangoDB.Client.Exception
6+
{
7+
public class QueryExecutionException : System.Exception
8+
{
9+
public QueryExecutionException(string message) : base(message)
10+
{
11+
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)