Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefano-ottolenghi committed Nov 17, 2023
1 parent addbb14 commit 87d49fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions javascript-manual/modules/ROOT/pages/query-simple.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ You can execute a query under the security context of a different user with the
For this to work, the user under which the `Driver` was created needs to have the link:{neo4j-docs-base-uri}/cypher-manual/current/administration/access-control/dbms-administration#access-control-dbms-administration-impersonation[appropriate permissions].
Impersonating a user is cheaper than creating a new `Driver` object.

[source, javascript, role=test-skip]
[source, javascript, test-skip]
----
await driver.executeQuery(
'MATCH (p:Person) RETURN p.name',
Expand All @@ -236,7 +236,7 @@ When impersonating a user, the query is run within the complete security context
const neo4j = require('neo4j-driver');
(async () => {
const URI = '<URI to Neo4j database>'
const URI = '<URI for Neo4j database>'
const USER = '<Username>'
const PASSWORD = '<Password>'
let driver, result
Expand All @@ -251,8 +251,9 @@ const neo4j = require('neo4j-driver');
driver = neo4j.driver(URI, neo4j.auth.basic(USER, PASSWORD))
await driver.verifyConnectivity()
} catch(err) {
return
console.log(`Connection error\n${err}\nCause: ${err.cause}`)
await driver.close()
return
}
// Create some nodes
Expand Down
2 changes: 2 additions & 0 deletions javascript-manual/modules/ROOT/pages/transactions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ const neo4j = require('neo4j-driver');
await driver.verifyConnectivity()
} catch(err) {
console.log(`-- Connection error --\n${err}\n-- Cause --\n${err.cause}`)
await driver.close()
return
}
Expand Down Expand Up @@ -200,6 +201,7 @@ const PASSWORD = '<Password>';
await driver.verifyConnectivity()
} catch(err) {
console.log(`-- Connection error --\n${err}\n-- Cause --\n${err.cause}`)
await driver.close()
return
}
Expand Down

0 comments on commit 87d49fd

Please sign in to comment.