File tree Expand file tree Collapse file tree 4 files changed +74
-3
lines changed
testkit-backend/src/main/java/neo4j/org/testkit/backend Expand file tree Collapse file tree 4 files changed +74
-3
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) "Neo4j"
3
+ * Neo4j Sweden AB [http://neo4j.com]
4
+ *
5
+ * This file is part of Neo4j.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+ package neo4j .org .testkit .backend ;
20
+
21
+ public class FrontendError extends RuntimeException
22
+ {
23
+ }
Original file line number Diff line number Diff line change 22
22
import io .netty .channel .ChannelHandlerContext ;
23
23
import io .netty .channel .ChannelInboundHandlerAdapter ;
24
24
import neo4j .org .testkit .backend .CustomDriverError ;
25
+ import neo4j .org .testkit .backend .FrontendError ;
25
26
import neo4j .org .testkit .backend .TestkitState ;
26
27
import neo4j .org .testkit .backend .messages .requests .TestkitRequest ;
27
28
import neo4j .org .testkit .backend .messages .responses .BackendError ;
@@ -160,6 +161,10 @@ else if ( throwable instanceof CustomDriverError )
160
161
)
161
162
.build ();
162
163
}
164
+ else if ( throwable instanceof FrontendError )
165
+ {
166
+ return neo4j .org .testkit .backend .messages .responses .FrontendError .builder ().build ();
167
+ }
163
168
else
164
169
{
165
170
return BackendError .builder ().data ( BackendError .BackendErrorBody .builder ().msg ( throwable .toString () ).build () ).build ();
Original file line number Diff line number Diff line change 20
20
21
21
import lombok .Getter ;
22
22
import lombok .Setter ;
23
+ import neo4j .org .testkit .backend .FrontendError ;
23
24
import neo4j .org .testkit .backend .TestkitState ;
24
25
import neo4j .org .testkit .backend .holder .SessionHolder ;
25
26
import neo4j .org .testkit .backend .messages .responses .TestkitResponse ;
@@ -44,7 +45,7 @@ public TestkitResponse process( TestkitState testkitState )
44
45
}
45
46
else
46
47
{
47
- throwable = new RuntimeException ( "Error from client in retryable tx" );
48
+ throwable = new FrontendError ( );
48
49
}
49
50
sessionHolder .getTxWorkFuture ().completeExceptionally ( throwable );
50
51
return null ;
@@ -64,7 +65,7 @@ public CompletionStage<TestkitResponse> processAsync( TestkitState testkitState
64
65
}
65
66
else
66
67
{
67
- throwable = new RuntimeException ( "Error from client in retryable tx" );
68
+ throwable = new FrontendError ( );
68
69
}
69
70
sessionHolder .getTxWorkFuture ().completeExceptionally ( throwable );
70
71
return null ;
@@ -85,7 +86,7 @@ public Mono<TestkitResponse> processRx( TestkitState testkitState )
85
86
}
86
87
else
87
88
{
88
- throwable = new RuntimeException ( "Error from client in retryable tx" );
89
+ throwable = new FrontendError ( );
89
90
}
90
91
sessionHolder .getTxWorkFuture ().completeExceptionally ( throwable );
91
92
return null ;
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) "Neo4j"
3
+ * Neo4j Sweden AB [http://neo4j.com]
4
+ *
5
+ * This file is part of Neo4j.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+ package neo4j .org .testkit .backend .messages .responses ;
20
+
21
+ import lombok .Builder ;
22
+ import lombok .Getter ;
23
+
24
+ @ Getter
25
+ @ Builder
26
+ public class FrontendError implements TestkitResponse
27
+ {
28
+ private final FrontendErrorBody data = new FrontendErrorBody ("Imagine client code that throws..." );
29
+
30
+ @ Override
31
+ public String testkitName ()
32
+ {
33
+ return "FrontendError" ;
34
+ }
35
+
36
+ @ Getter
37
+ @ Builder
38
+ public static class FrontendErrorBody
39
+ {
40
+ private String msg ;
41
+ }
42
+ }
You can’t perform that action at this time.
0 commit comments