Skip to content

[5.0] Fix logging of driver errors containing bigints in testkit backend #1279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions packages/testkit-backend/src/request-handlers-rx.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as responses from './responses.js'
import { from } from 'rxjs'
import stringify from './stringify.js'

// Handlers which didn't change depending
export {
Expand Down Expand Up @@ -108,7 +109,7 @@ export function SessionRun (_, context, data, wire) {
try {
rxResult = session.run(cypher, params, { metadata, timeout })
} catch (e) {
console.log('got some err: ' + JSON.stringify(e))
console.log('got some err: ' + stringify(e))
wire.writeError(e)
return
}
Expand Down Expand Up @@ -150,11 +151,11 @@ export function SessionBeginTransaction (_, context, data, wire) {
const id = context.addTx(tx, sessionId)
wire.writeResponse(responses.Transaction({ id }))
}).catch(e => {
console.log('got some err: ' + JSON.stringify(e))
console.log('got some err: ' + stringify(e))
wire.writeError(e)
})
} catch (e) {
console.log('got some err: ' + JSON.stringify(e))
console.log('got some err: ' + stringify(e))
wire.writeError(e)
}
}
Expand Down Expand Up @@ -189,7 +190,7 @@ export function TransactionRollback (_, context, data, wire) {
.toPromise()
.then(() => wire.writeResponse(responses.Transaction({ id })))
.catch(e => {
console.log('got some err: ' + JSON.stringify(e))
console.log('got some err: ' + stringify(e))
wire.writeError(e)
})
}
Expand All @@ -201,7 +202,7 @@ export function TransactionCommit (_, context, data, wire) {
.toPromise()
.then(() => wire.writeResponse(responses.Transaction({ id })))
.catch(e => {
console.log('got some err: ' + JSON.stringify(e))
console.log('got some err: ' + stringify(e))
wire.writeError(e)
})
}
Expand Down
17 changes: 9 additions & 8 deletions packages/testkit-backend/src/request-handlers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as responses from './responses.js'
import configurableConsole from './console.configurable.js'
import stringify from './stringify.js'

export function throwFrontendError () {
throw new Error('TestKit FrontendError')
Expand Down Expand Up @@ -191,7 +192,7 @@ export function SessionRun (_, context, data, wire) {
try {
result = session.run(cypher, params, { metadata, timeout })
} catch (e) {
console.log('got some err: ' + JSON.stringify(e))
console.log('got some err: ' + stringify(e))
wire.writeError(e)
return
}
Expand All @@ -214,7 +215,7 @@ export function ResultNext (_, context, data, wire) {
wire.writeResponse(responses.Record({ record: value }, { binder: context.binder }))
}
}).catch(e => {
console.log('got some err: ' + JSON.stringify(e))
console.log('got some err: ' + stringify(e))
wire.writeError(e)
})
}
Expand All @@ -232,7 +233,7 @@ export function ResultPeek (_, context, data, wire) {
wire.writeResponse(responses.Record({ record: value }, { binder: context.binder }))
}
}).catch(e => {
console.log('got some err: ' + JSON.stringify(e))
console.log('got some err: ' + stringify(e))
wire.writeError(e)
})
}
Expand All @@ -241,8 +242,8 @@ export function ResultConsume (_, context, data, wire) {
const { resultId } = data
const result = context.getResult(resultId)

let summaryPromise = 'recordIt' in result
? (async () => {return (await result.recordIt.return()).value})()
const summaryPromise = 'recordIt' in result
? (async () => { return (await result.recordIt.return()).value })()
: result.summary()
return summaryPromise.then(summary => {
wire.writeResponse(responses.Summary({ summary }, { binder: context.binder }))
Expand Down Expand Up @@ -317,11 +318,11 @@ export function SessionBeginTransaction (_, context, data, wire) {
const id = context.addTx(tx, sessionId)
wire.writeResponse(responses.Transaction({ id }))
}).catch(e => {
console.log('got some err: ' + JSON.stringify(e))
console.log('got some err: ' + stringify(e))
wire.writeError(e)
})
} catch (e) {
console.log('got some err: ' + JSON.stringify(e))
console.log('got some err: ' + stringify(e))
wire.writeError(e)
}
}
Expand All @@ -332,7 +333,7 @@ export function TransactionCommit (_, context, data, wire) {
return tx.commit()
.then(() => wire.writeResponse(responses.Transaction({ id })))
.catch(e => {
console.log('got some err: ' + JSON.stringify(e))
console.log('got some err: ' + stringify(e))
wire.writeError(e)
})
}
Expand Down