I recently wrote a helper function to handle errors, and I'm attempting to pass it as an argument to the catch
function within a promise:
fetchRecords().then (found) ->
$scope.recprds = found;
.catch( Session.handleError )
.finally( -> $scope.querying = false )
When this code is translated into JavaScript, it looks like this:
fetchRecords().then(function(found) {
return $scope.records = found;
})["catch"](Session.handleError)["finally"](function() {
return $scope.querying = false;
});
The issue arises because finally
is not a property of my Session.handleError
function, causing a JavaScript error.
Is there a different syntax that would be more appropriate in this scenario?
Experiment with it on coffeescript.org