Skip to content

Commit dc4f11c

Browse files
committed
Fail fast on rediscovery when 'Neo.ClientError.Statement.ArgumentError' failure
When trying to impersonate an invalid user, the routing procedure returns `Neo.ClientError.Statement.ArgumentError`. This type of failure is not in the fail fast list, thus this is wrapped up in the generic rediscovery error triggering the retry in the transaction functions. Since this kind of error is not recoverable, retrying on it is not need and desirable. Then, failing fast on `Neo.ClientError.Statement.ArgumentError` failures speeds up the error bubbling and avoids unnecessary load in the client and server.
1 parent b1ff30b commit dc4f11c

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

packages/bolt-connection/src/connection-provider/connection-provider-routing.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const INVALID_BOOKMARK_MIXTURE_CODE =
4848
'Neo.ClientError.Transaction.InvalidBookmarkMixture'
4949
const AUTHORIZATION_EXPIRED_CODE =
5050
'Neo.ClientError.Security.AuthorizationExpired'
51+
const INVALID_ARGUMENT_ERROR = 'Neo.ClientError.Statement.ArgumentError'
5152

5253
const SYSTEM_DB_NAME = 'system'
5354
const DEFAULT_DB_NAME = null
@@ -703,7 +704,8 @@ function _isFailFastError (error) {
703704
return [
704705
DATABASE_NOT_FOUND_CODE,
705706
INVALID_BOOKMARK_CODE,
706-
INVALID_BOOKMARK_MIXTURE_CODE
707+
INVALID_BOOKMARK_MIXTURE_CODE,
708+
INVALID_ARGUMENT_ERROR
707709
].includes(error.code)
708710
}
709711

packages/bolt-connection/test/connection-provider/connection-provider-routing.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,6 +1669,7 @@ describe.each([
16691669
'Neo.ClientError.Database.DatabaseNotFound',
16701670
'Neo.ClientError.Transaction.InvalidBookmark',
16711671
'Neo.ClientError.Transaction.InvalidBookmarkMixture',
1672+
'Neo.ClientError.Statement.ArgumentError',
16721673
'Neo.ClientError.Security.Forbidden',
16731674
'Neo.ClientError.Security.IWontTellYou'
16741675
])('with "%s"', errorCode => {

packages/neo4j-driver-deno/lib/bolt-connection/connection-provider/connection-provider-routing.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const INVALID_BOOKMARK_MIXTURE_CODE =
4848
'Neo.ClientError.Transaction.InvalidBookmarkMixture'
4949
const AUTHORIZATION_EXPIRED_CODE =
5050
'Neo.ClientError.Security.AuthorizationExpired'
51+
const INVALID_ARGUMENT_ERROR = 'Neo.ClientError.Statement.ArgumentError'
5152

5253
const SYSTEM_DB_NAME = 'system'
5354
const DEFAULT_DB_NAME = null
@@ -703,7 +704,8 @@ function _isFailFastError (error) {
703704
return [
704705
DATABASE_NOT_FOUND_CODE,
705706
INVALID_BOOKMARK_CODE,
706-
INVALID_BOOKMARK_MIXTURE_CODE
707+
INVALID_BOOKMARK_MIXTURE_CODE,
708+
INVALID_ARGUMENT_ERROR
707709
].includes(error.code)
708710
}
709711

0 commit comments

Comments
 (0)