Skip to content

Commit 1fea426

Browse files
committed
fix(fastq): adds missing 'catch' method to promises
Fixes #183
1 parent 420f9dd commit 1fea426

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/module/fastq.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
*/
1111
RMModule.factory('RMFastQ', [function() {
1212

13-
var isFunction = angular.isFunction;
13+
var isFunction = angular.isFunction,
14+
catchError = function(_error) {
15+
return this.then(null, _error);
16+
};
1417

1518
function simpleQ(_val, _withError) {
1619

@@ -22,6 +25,7 @@ RMModule.factory('RMFastQ', [function() {
2225
then: function(_success, _error) {
2326
return simpleQ(_withError ? _error(_val) : _success(_val));
2427
},
28+
'catch': catchError,
2529
'finally': function(_cb) {
2630
var result = _cb();
2731
if(result && isFunction(_val.then)) {
@@ -55,6 +59,7 @@ RMModule.factory('RMFastQ', [function() {
5559
simple.then(_success, _error) :
5660
wrappedQ(_promise.then(_success, _error));
5761
},
62+
'catch': catchError,
5863
'finally': function(_cb) {
5964
return simple ?
6065
simple['finally'](_cb) :

0 commit comments

Comments
 (0)