|
25 | 25 | import org.neo4j.gds.core.loading.construction.RelationshipsBuilder; |
26 | 26 | import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; |
27 | 27 | import org.neo4j.graphdb.QueryStatistics; |
| 28 | +import org.neo4j.kernel.impl.query.QueryExecutionKernelException; |
28 | 29 | import org.neo4j.kernel.impl.query.QuerySubscriber; |
29 | 30 | import org.neo4j.values.AnyValue; |
30 | 31 | import org.neo4j.values.storable.NumberValue; |
31 | 32 | import org.neo4j.values.storable.TextValue; |
32 | 33 |
|
| 34 | +import java.util.Optional; |
33 | 35 | import java.util.Set; |
34 | 36 |
|
35 | 37 | import static org.neo4j.gds.RelationshipType.ALL_RELATIONSHIPS; |
@@ -65,6 +67,8 @@ class RelationshipSubscriber implements QuerySubscriber { |
65 | 67 |
|
66 | 68 | private RelationshipsBuilder allRelationshipsBuilder; |
67 | 69 |
|
| 70 | + private Optional<RuntimeException> error = Optional.empty(); |
| 71 | + |
68 | 72 | RelationshipSubscriber( |
69 | 73 | IdMap idMap, |
70 | 74 | CypherRelationshipLoader.Context loaderContext, |
@@ -105,6 +109,10 @@ void initialize(String[] fieldNames, ObjectDoubleMap<String> propertyDefaultValu |
105 | 109 | this.propertyValueBuffer = new double[propertyCount]; |
106 | 110 | } |
107 | 111 |
|
| 112 | + Optional<RuntimeException> error() { |
| 113 | + return error; |
| 114 | + } |
| 115 | + |
108 | 116 | public long rows() { |
109 | 117 | return rows; |
110 | 118 | } |
@@ -183,7 +191,13 @@ public void onRecordCompleted() { |
183 | 191 | } |
184 | 192 | @Override |
185 | 193 | public void onError(Throwable throwable) { |
186 | | - throw new RuntimeException(throwable); |
| 194 | + if (throwable instanceof RuntimeException) { |
| 195 | + this.error = Optional.of((RuntimeException) throwable); |
| 196 | + } else if (throwable instanceof QueryExecutionKernelException) { |
| 197 | + this.error = Optional.of(((QueryExecutionKernelException) throwable).asUserException()); |
| 198 | + } else { |
| 199 | + this.error = Optional.of(new RuntimeException(throwable)); |
| 200 | + } |
187 | 201 | } |
188 | 202 |
|
189 | 203 | @Override |
|
0 commit comments