File tree 2 files changed +14
-3
lines changed
2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -228,7 +228,7 @@ export default class NodeChannel {
228
228
* @param {ChannelConfig } config - configuration for this channel.
229
229
*/
230
230
constructor ( config ) {
231
- let self = this
231
+ const self = this
232
232
233
233
this . id = _CONNECTION_IDGEN ++
234
234
this . _pending = [ ]
@@ -257,7 +257,7 @@ export default class NodeChannel {
257
257
self . _conn . on ( 'end' , self . _handleConnectionTerminated )
258
258
259
259
// Drain all pending messages
260
- let pending = self . _pending
260
+ const pending = self . _pending
261
261
self . _pending = null
262
262
for ( let i = 0 ; i < pending . length ; i ++ ) {
263
263
self . write ( pending [ i ] )
@@ -270,7 +270,12 @@ export default class NodeChannel {
270
270
}
271
271
272
272
_handleConnectionError ( err ) {
273
- let msg = err . message || 'Failed to connect to server'
273
+ let msg =
274
+ 'Failed to connect to server. ' +
275
+ 'Please ensure that your database is listening on the correct host and port ' +
276
+ 'and that you have compatible encryption settings both on Neo4j server and driver. ' +
277
+ 'Note that the default encryption setting has changed in Neo4j 4.0.'
278
+ if ( err . message ) msg += ' Caused by: ' + err . message
274
279
this . _error = newError ( msg , this . _connectionErrorCode )
275
280
if ( this . onerror ) {
276
281
this . onerror ( this . _error )
Original file line number Diff line number Diff line change @@ -123,8 +123,14 @@ describe('#integration driver', () => {
123
123
} )
124
124
. catch ( error => {
125
125
const doesNotContainAddress = error . message . indexOf ( ':80' ) < 0
126
+ const doesNotContainBetterErrorMessage =
127
+ error . message . indexOf ( 'Failed to connect to server' ) < 0
126
128
if ( doesNotContainAddress ) {
127
129
done . fail ( `Expected to contain ':80' but was: ${ error . message } ` )
130
+ } else if ( doesNotContainBetterErrorMessage ) {
131
+ done . fail (
132
+ `Expected to contain 'Failed to connect to server' but was: ${ error . message } `
133
+ )
128
134
} else {
129
135
expect ( error . code ) . toEqual ( neo4j . error . SERVICE_UNAVAILABLE )
130
136
done ( )
You can’t perform that action at this time.
0 commit comments