Skip to content

Commit

Permalink
fix(#20): Silent error in waitForUser() (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
DAB0mB authored and Urigo committed Apr 22, 2016
1 parent d482b90 commit e0292c0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/angular-meteor-auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ angular.module(name, [
*/
.factory('$$Auth', [
'$Mixer',
'$log',

function($Mixer) {
function($Mixer, $log) {
const Accounts = (Package['accounts-base'] || {}).Accounts;

if (!Accounts) {
Expand Down Expand Up @@ -104,7 +105,9 @@ function($Mixer) {
// Silent error
$$Auth.$waitForUser = function() {
// Silent error
return this.$awaitUser().catch();
return this.$awaitUser().catch((err) => {
$log.debug(`user login has failed (${err})`);
});
};

// No validation
Expand Down
6 changes: 5 additions & 1 deletion tests/integration/auth.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,11 @@ describe('angular-meteor.auth', function() {
});

it('should call $awaitUser() and ignore error', function(done) {
scope.$waitForUser().catch(done).finally(done);
scope.$waitForUser()
.then(angular.noop, done.fail)
.catch(done.fail)
.finally(done);

scope.$$afterFlush('$$throttledDigest');
});
});
Expand Down

0 comments on commit e0292c0

Please sign in to comment.