Skip to content

Commit e585fe4

Browse files
committed
Revert "merge gql errors and number is number (#1231)"
This reverts commit 2834e03.
1 parent 47478f3 commit e585fe4

37 files changed

+154
-2548
lines changed

packages/bolt-connection/src/bolt/bolt-protocol-v1.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ const {
4545
txConfig: { TxConfig }
4646
} = internal
4747

48-
const DEFAULT_DIAGNOSTIC_RECORD = Object.freeze({
49-
OPERATION: '',
50-
OPERATION_CODE: '0',
51-
CURRENT_SCHEMA: '/'
52-
})
53-
5448
export default class BoltProtocol {
5549
/**
5650
* @callback CreateResponseHandler Creates the response handler
@@ -170,13 +164,6 @@ export default class BoltProtocol {
170164
return metadata
171165
}
172166

173-
enrichErrorMetadata (metadata) {
174-
return {
175-
...metadata,
176-
diagnostic_record: metadata.diagnostic_record !== null ? { ...DEFAULT_DIAGNOSTIC_RECORD, ...metadata.diagnostic_record } : null
177-
}
178-
}
179-
180167
/**
181168
* Perform initialization and authentication of the underlying connection.
182169
* @param {Object} param

packages/bolt-connection/src/bolt/bolt-protocol-v5x7.js

Lines changed: 0 additions & 59 deletions
This file was deleted.

packages/bolt-connection/src/bolt/bolt-protocol-v5x7.transformer.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

packages/bolt-connection/src/bolt/create.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import BoltProtocolV5x3 from './bolt-protocol-v5x3'
3131
import BoltProtocolV5x4 from './bolt-protocol-v5x4'
3232
import BoltProtocolV5x5 from './bolt-protocol-v5x5'
3333
import BoltProtocolV5x6 from './bolt-protocol-v5x6'
34-
import BoltProtocolV5x7 from './bolt-protocol-v5x7'
3534
// eslint-disable-next-line no-unused-vars
3635
import { Chunker, Dechunker } from '../channel'
3736
import ResponseHandler from './response-handler'
@@ -65,7 +64,6 @@ export default function create ({
6564
const createResponseHandler = protocol => {
6665
const responseHandler = new ResponseHandler({
6766
transformMetadata: protocol.transformMetadata.bind(protocol),
68-
enrichErrorMetadata: protocol.enrichErrorMetadata.bind(protocol),
6967
log,
7068
observer
7169
})
@@ -249,14 +247,6 @@ function createProtocol (
249247
log,
250248
onProtocolError,
251249
serversideRouting)
252-
case 5.7:
253-
return new BoltProtocolV5x7(server,
254-
chunker,
255-
packingConfig,
256-
createResponseHandler,
257-
log,
258-
onProtocolError,
259-
serversideRouting)
260250
default:
261251
throw newError('Unknown Bolt protocol version: ' + version)
262252
}

packages/bolt-connection/src/bolt/handshake.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function parseNegotiatedResponse (buffer, log) {
7676
*/
7777
function newHandshakeBuffer () {
7878
return createHandshakeMessage([
79-
[version(5, 7), version(5, 0)],
79+
[version(5, 6), version(5, 0)],
8080
[version(4, 4), version(4, 2)],
8181
version(4, 1),
8282
version(3, 0)

packages/bolt-connection/src/bolt/response-handler.js

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
import { newError, newGQLError, json } from 'neo4j-driver-core'
17+
import { newError, json } from 'neo4j-driver-core'
1818

1919
// Signature bytes for each response message type
2020
const SUCCESS = 0x70 // 0111 0000 // SUCCESS <metadata>
@@ -70,11 +70,10 @@ export default class ResponseHandler {
7070
* @param {Logger} log The logger
7171
* @param {ResponseHandler~Observer} observer Object which will be notified about errors
7272
*/
73-
constructor ({ transformMetadata, enrichErrorMetadata, log, observer } = {}) {
73+
constructor ({ transformMetadata, log, observer } = {}) {
7474
this._pendingObservers = []
7575
this._log = log
7676
this._transformMetadata = transformMetadata || NO_OP_IDENTITY
77-
this._enrichErrorMetadata = enrichErrorMetadata || NO_OP_IDENTITY
7877
this._observer = Object.assign(
7978
{
8079
onObserversCountChange: NO_OP,
@@ -116,7 +115,11 @@ export default class ResponseHandler {
116115
this._log.debug(`S: FAILURE ${json.stringify(msg)}`)
117116
}
118117
try {
119-
this._currentFailure = this._handleErrorPayload(this._enrichErrorMetadata(payload))
118+
const standardizedCode = _standardizeCode(payload.code)
119+
const error = newError(payload.message, standardizedCode)
120+
this._currentFailure = this._observer.onErrorApplyTransformation(
121+
error
122+
)
120123
this._currentObserver.onError(this._currentFailure)
121124
} finally {
122125
this._updateCurrentObserver()
@@ -193,23 +196,6 @@ export default class ResponseHandler {
193196
_resetFailure () {
194197
this._currentFailure = null
195198
}
196-
197-
_handleErrorPayload (payload) {
198-
const standardizedCode = _standardizeCode(payload.code)
199-
const cause = payload.cause != null ? this._handleErrorCause(payload.cause) : undefined
200-
const error = newError(payload.message, standardizedCode, cause, payload.gql_status, payload.description, payload.diagnostic_record)
201-
return this._observer.onErrorApplyTransformation(
202-
error
203-
)
204-
}
205-
206-
_handleErrorCause (payload) {
207-
const cause = payload.cause != null ? this._handleErrorCause(payload.cause) : undefined
208-
const error = newGQLError(payload.message, cause, payload.gql_status, payload.description, payload.diagnostic_record)
209-
return this._observer.onErrorApplyTransformation(
210-
error
211-
)
212-
}
213199
}
214200

215201
/**

packages/bolt-connection/src/connection/connection-channel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ export default class ChannelConnection extends Connection {
441441
reject(error)
442442
} else {
443443
const neo4jError = this._handleProtocolError(
444-
`Received FAILURE as a response for RESET: ${error}`
444+
'Received FAILURE as a response for RESET: ' + error
445445
)
446446
reject(neo4jError)
447447
}

packages/bolt-connection/test/bolt/__snapshots__/bolt-protocol-v5x7.test.js.snap

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)