File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
test/integration/gh-issues Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,11 @@ class Connection extends EventEmitter {
8585 if ( net . isIP ( host ) === 0 ) {
8686 options . servername = host
8787 }
88- self . stream = tls . connect ( options )
88+ try {
89+ self . stream = tls . connect ( options )
90+ } catch ( err ) {
91+ return self . emit ( 'error' , err )
92+ }
8993 self . attachListeners ( self . stream )
9094 self . stream . on ( 'error' , reportStreamError )
9195
Original file line number Diff line number Diff line change 1+ 'use strict'
2+
3+ const pg = require ( '../../../lib' )
4+ const helper = require ( '../test-helper' )
5+
6+ const suite = new helper . Suite ( )
7+
8+ suite . test ( 'bad ssl credentials do not cause crash' , ( done ) => {
9+ const config = {
10+ ssl : {
11+ ca : 'invalid_value' ,
12+ key : 'invalid_value' ,
13+ cert : 'invalid_value' ,
14+ } ,
15+ }
16+
17+ const client = new pg . Client ( config )
18+
19+ client . connect ( ( err ) => {
20+ assert ( err )
21+ client . end ( )
22+ done ( )
23+ } )
24+ } )
You can’t perform that action at this time.
0 commit comments