1
1
import * as responses from './responses.js'
2
2
import configurableConsole from './console.configurable.js'
3
+ import stringify from './stringify.js'
3
4
4
5
export function throwFrontendError ( ) {
5
6
throw new Error ( 'TestKit FrontendError' )
@@ -191,7 +192,7 @@ export function SessionRun (_, context, data, wire) {
191
192
try {
192
193
result = session . run ( cypher , params , { metadata, timeout } )
193
194
} catch ( e ) {
194
- console . log ( 'got some err: ' + JSON . stringify ( e ) )
195
+ console . log ( 'got some err: ' + stringify ( e ) )
195
196
wire . writeError ( e )
196
197
return
197
198
}
@@ -214,7 +215,7 @@ export function ResultNext (_, context, data, wire) {
214
215
wire . writeResponse ( responses . Record ( { record : value } , { binder : context . binder } ) )
215
216
}
216
217
} ) . catch ( e => {
217
- console . log ( 'got some err: ' + JSON . stringify ( e ) )
218
+ console . log ( 'got some err: ' + stringify ( e ) )
218
219
wire . writeError ( e )
219
220
} )
220
221
}
@@ -232,7 +233,7 @@ export function ResultPeek (_, context, data, wire) {
232
233
wire . writeResponse ( responses . Record ( { record : value } , { binder : context . binder } ) )
233
234
}
234
235
} ) . catch ( e => {
235
- console . log ( 'got some err: ' + JSON . stringify ( e ) )
236
+ console . log ( 'got some err: ' + stringify ( e ) )
236
237
wire . writeError ( e )
237
238
} )
238
239
}
@@ -241,8 +242,8 @@ export function ResultConsume (_, context, data, wire) {
241
242
const { resultId } = data
242
243
const result = context . getResult ( resultId )
243
244
244
- let summaryPromise = 'recordIt' in result
245
- ? ( async ( ) => { return ( await result . recordIt . return ( ) ) . value } ) ( )
245
+ const summaryPromise = 'recordIt' in result
246
+ ? ( async ( ) => { return ( await result . recordIt . return ( ) ) . value } ) ( )
246
247
: result . summary ( )
247
248
return summaryPromise . then ( summary => {
248
249
wire . writeResponse ( responses . Summary ( { summary } , { binder : context . binder } ) )
@@ -317,11 +318,11 @@ export function SessionBeginTransaction (_, context, data, wire) {
317
318
const id = context . addTx ( tx , sessionId )
318
319
wire . writeResponse ( responses . Transaction ( { id } ) )
319
320
} ) . catch ( e => {
320
- console . log ( 'got some err: ' + JSON . stringify ( e ) )
321
+ console . log ( 'got some err: ' + stringify ( e ) )
321
322
wire . writeError ( e )
322
323
} )
323
324
} catch ( e ) {
324
- console . log ( 'got some err: ' + JSON . stringify ( e ) )
325
+ console . log ( 'got some err: ' + stringify ( e ) )
325
326
wire . writeError ( e )
326
327
}
327
328
}
@@ -332,7 +333,7 @@ export function TransactionCommit (_, context, data, wire) {
332
333
return tx . commit ( )
333
334
. then ( ( ) => wire . writeResponse ( responses . Transaction ( { id } ) ) )
334
335
. catch ( e => {
335
- console . log ( 'got some err: ' + JSON . stringify ( e ) )
336
+ console . log ( 'got some err: ' + stringify ( e ) )
336
337
wire . writeError ( e )
337
338
} )
338
339
}
0 commit comments