11import * as responses from './responses.js'
22import configurableConsole from './console.configurable.js'
3+ import stringify from './stringify.js'
34
45export function throwFrontendError ( ) {
56 throw new Error ( 'TestKit FrontendError' )
@@ -191,7 +192,7 @@ export function SessionRun (_, context, data, wire) {
191192 try {
192193 result = session . run ( cypher , params , { metadata, timeout } )
193194 } catch ( e ) {
194- console . log ( 'got some err: ' + JSON . stringify ( e ) )
195+ console . log ( 'got some err: ' + stringify ( e ) )
195196 wire . writeError ( e )
196197 return
197198 }
@@ -214,7 +215,7 @@ export function ResultNext (_, context, data, wire) {
214215 wire . writeResponse ( responses . Record ( { record : value } , { binder : context . binder } ) )
215216 }
216217 } ) . catch ( e => {
217- console . log ( 'got some err: ' + JSON . stringify ( e ) )
218+ console . log ( 'got some err: ' + stringify ( e ) )
218219 wire . writeError ( e )
219220 } )
220221}
@@ -232,7 +233,7 @@ export function ResultPeek (_, context, data, wire) {
232233 wire . writeResponse ( responses . Record ( { record : value } , { binder : context . binder } ) )
233234 }
234235 } ) . catch ( e => {
235- console . log ( 'got some err: ' + JSON . stringify ( e ) )
236+ console . log ( 'got some err: ' + stringify ( e ) )
236237 wire . writeError ( e )
237238 } )
238239}
@@ -241,8 +242,8 @@ export function ResultConsume (_, context, data, wire) {
241242 const { resultId } = data
242243 const result = context . getResult ( resultId )
243244
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 } ) ( )
246247 : result . summary ( )
247248 return summaryPromise . then ( summary => {
248249 wire . writeResponse ( responses . Summary ( { summary } , { binder : context . binder } ) )
@@ -317,11 +318,11 @@ export function SessionBeginTransaction (_, context, data, wire) {
317318 const id = context . addTx ( tx , sessionId )
318319 wire . writeResponse ( responses . Transaction ( { id } ) )
319320 } ) . catch ( e => {
320- console . log ( 'got some err: ' + JSON . stringify ( e ) )
321+ console . log ( 'got some err: ' + stringify ( e ) )
321322 wire . writeError ( e )
322323 } )
323324 } catch ( e ) {
324- console . log ( 'got some err: ' + JSON . stringify ( e ) )
325+ console . log ( 'got some err: ' + stringify ( e ) )
325326 wire . writeError ( e )
326327 }
327328}
@@ -332,7 +333,7 @@ export function TransactionCommit (_, context, data, wire) {
332333 return tx . commit ( )
333334 . then ( ( ) => wire . writeResponse ( responses . Transaction ( { id } ) ) )
334335 . catch ( e => {
335- console . log ( 'got some err: ' + JSON . stringify ( e ) )
336+ console . log ( 'got some err: ' + stringify ( e ) )
336337 wire . writeError ( e )
337338 } )
338339}
0 commit comments