File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -20,11 +20,17 @@ function Client(url, retryAttempts) {
2020 /** @type {Number } */
2121 this . _reopenTimeout = null ;
2222 /** @type {Number } */
23- this . _retryAttempts = retryAttempts || 3 ; ;
23+ this . _retryAttempts = retryAttempts || 3 ;
2424 /** @type {Number } */
2525 this . _counter = 0 ;
26+ /** @type {Function } */
27+ this . _errorCallback = null ;
2628}
2729
30+ Client . prototype . onCaptureError = function ( callback ) {
31+ this . _errorCallback = callback ;
32+ } ;
33+
2834Client . prototype . open = function ( ) {
2935 clearTimeout ( this . _reopenTimeout ) ;
3036 this . _reopenTimeout = null ;
@@ -47,7 +53,9 @@ Client.prototype._reopen = function() {
4753 this . _counter ++ ;
4854 this . open ( ) ;
4955 } else {
50- throw new Error ( 'Reached max retryAttempts' ) ;
56+ if ( typeof this . _errorCallback === 'function' ) {
57+ this . _errorCallback ( new Error ( 'Reached max retryAttempts' ) ) ;
58+ }
5159 }
5260 } . bind ( this ) , 1000 * this . _counter ) ;
5361} ;
Original file line number Diff line number Diff line change 11{
22 "name" : " socket-redis" ,
3- "version" : " 3.3.1 " ,
3+ "version" : " 3.3.3 " ,
44 "description" : " Redis to SockJS relay" ,
55 "main" : " socket-redis.js" ,
66 "bin" : {
You can’t perform that action at this time.
0 commit comments