11import neo4j from './neo4j'
2- import {
3- cypherToNative
4- } from './cypher-native-binders.js'
2+ import { cypherToNative } from './cypher-native-binders.js'
53import * as responses from './responses.js'
64
5+ export function throwFrontendError ( ) {
6+ throw new Error ( "TestKit FrontendError" )
7+ }
8+
9+ export function isFrontendError ( error ) {
10+ return error . message === 'TestKit FrontendError'
11+ }
12+
713export function NewDriver ( context , data , wire ) {
814 const {
915 uri,
@@ -96,8 +102,7 @@ export function DriverClose (context, data, wire) {
96102 . then ( ( ) => {
97103 wire . writeResponse ( responses . Driver ( { id : driverId } ) )
98104 } )
99- . catch ( err => wire . writeError ( err ) )
100- . finally ( ( ) => context . removeDriver ( driverId ) )
105+ . catch ( err => wire . writeError ( err ) )
101106}
102107
103108export function NewSession ( context , data , wire ) {
@@ -254,7 +259,7 @@ export function RetryablePositive (context, data, wire) {
254259
255260export function RetryableNegative ( context , data , wire ) {
256261 const { sessionId, errorId } = data
257- const error = context . getError ( errorId ) || new Error ( 'Client error ' )
262+ const error = context . getError ( errorId ) || new Error ( 'TestKit FrontendError ' )
258263 context . getTxsBySessionId ( sessionId ) . forEach ( tx => {
259264 tx . reject ( error )
260265 } )
@@ -263,7 +268,7 @@ export function RetryableNegative (context, data, wire) {
263268export function SessionBeginTransaction ( context , data , wire ) {
264269 const { sessionId, txMeta : metadata , timeout } = data
265270 const session = context . getSession ( sessionId )
266-
271+
267272 try {
268273 return session . beginTransaction ( { metadata, timeout } )
269274 . then ( tx => {
0 commit comments