Skip to content

Commit

Permalink
Improve error checking in the backend
Browse files Browse the repository at this point in the history
  • Loading branch information
bigmontz committed Apr 11, 2022
1 parent f21f1f0 commit 39cb7c9
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions packages/testkit-backend/src/controller/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,21 @@ export default class LocalController extends Controller {
}

_writeError (contextId, e) {
if (e.name) {
if (isFrontendError(e)) {
this._writeResponse(contextId, newResponse('FrontendError', {
msg: 'Simulating the client code throwing some error.',
}))
} else {
const id = this._contexts.get(contextId).addError(e)
if (e instanceof Neo4jError) {
const id = this._contexts.get(contextId).addError(e)
this._writeResponse(contextId, newResponse('DriverError', {
id,
msg: e.message,
code: e.code,
errorType: e.category
}))
}
return
} else if (isFrontendError(e)) {
this._writeResponse(contextId, newResponse('FrontendError', {
msg: 'Simulating the client code throwing some error.',
}))
} else {
this._writeBackendError(contextId, e)
}
this._writeBackendError(contextId, e)
}

}
Expand Down

0 comments on commit 39cb7c9

Please sign in to comment.