File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ function init(cfg) {
1212 return co ( function * gen ( ) {
1313 console . log ( 'Connecting to the database uri=%s' , conString ) ;
1414 const connection = new cosql . Connection ( conString ) ;
15+ // Always attach an error listener
16+ connection . on ( 'error' , ( err ) => this . emit ( 'error' , err ) ) ;
1517 let sql = cfg . query ;
1618 yield connection . connect ( ) ;
1719 console . log ( 'Preparing query=%s' , sql ) ;
@@ -46,7 +48,7 @@ function init(cfg) {
4648 console . log ( 'Resulting SQL=%s' , sql ) ;
4749 yield pstmt . prepare ( sql ) ;
4850 console . log ( 'Preparing statement created' ) ;
49- } ) ;
51+ } . bind ( this ) ) ;
5052}
5153
5254/**
Original file line number Diff line number Diff line change @@ -16,8 +16,9 @@ function init(cfg) {
1616 return co ( function * gen ( ) {
1717 console . log ( 'Connecting to the database uri=%s' , conString ) ;
1818 connection = new cosql . Connection ( conString ) ;
19+ connection . on ( 'error' , ( err ) => this . emit ( 'error' , err ) ) ;
1920 yield connection . connect ( ) ;
20- } ) ;
21+ } . bind ( this ) ) ;
2122}
2223/**
2324 * This method will be called from elastic.io platform providing following data
You can’t perform that action at this time.
0 commit comments