Skip to content

Commit 942942b

Browse files
jeffreylovitzswilly22
authored andcommitted
Type error (#45)
* runtime error reporting * Switch to last-return exception checking
1 parent 76246ba commit 942942b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

redisgraph/query_result.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from .node import Node
22
from .edge import Edge
33
from prettytable import PrettyTable
4+
from redis import ResponseError
45

56

67
class ResultSetColumnTypes(object):
@@ -21,7 +22,6 @@ class ResultSetScalarTypes(object):
2122
VALUE_EDGE = 7
2223
VALUE_NODE = 8
2324

24-
2525
class QueryResult(object):
2626
LABELS_ADDED = 'Labels added'
2727
NODES_CREATED = 'Nodes created'
@@ -36,6 +36,10 @@ def __init__(self, graph, response):
3636
self.header = []
3737
self.result_set = []
3838

39+
# If we encountered a run-time error, the last response element will be an exception.
40+
if isinstance(response[-1], ResponseError):
41+
raise response[-1]
42+
3943
if len(response) is 1:
4044
self.parse_statistics(response[0])
4145
else:

0 commit comments

Comments
 (0)