Skip to content

Commit b6549b6

Browse files
committed
Mention driver callbacks in the readme
1 parent d9fcfdb commit b6549b6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@ driver.close();
6868
// Create a driver instance, for the user neo4j with password neo4j.
6969
var driver = neo4j.driver("bolt://localhost", neo4j.auth.basic("neo4j", "neo4j"));
7070

71+
// Register a callback to know if driver creation was successful:
72+
driver.onCompleted = function() {
73+
// proceed with using the driver, it was successfully instantiated
74+
};
75+
76+
// Register a callback to know if driver creation failed.
77+
// This could happen due to wrong credentials or database unavailability:
78+
driver.onError = function(error) {
79+
console.log('Driver instantiation failed', error);
80+
};
81+
7182
// Create a session to run Cypher statements in.
7283
// Note: Always make sure to close sessions when you are done using them!
7384
var session = driver.session();

0 commit comments

Comments
 (0)