Skip to content

Commit 1d64c84

Browse files
author
Costica Puntaru
committed
2 parents 797cda1 + f963798 commit 1d64c84

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

dist/angular-permission.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@
243243
return this;
244244
};
245245

246-
this.$get = ['$q', function ($q) {
246+
this.$get = ['$q', '$log', function ($q, $log) {
247247
var asyncRoleList = [$q.resolve()];
248248
var Permission = {
249249
asyncRole: function (promise) {
@@ -291,12 +291,12 @@
291291

292292
// If no roles left to validate reject promise
293293
if (!currentRole) {
294-
deferred.reject();
295-
return deferred.promise;
294+
return $q.reject();
296295
}
297296
// Validate role definition exists
298297
if (!angular.isFunction(Permission.roleValidations[currentRole])) {
299-
throw new Error('undefined role or invalid role validation');
298+
$log.error('undefined role or invalid role validation');
299+
return deferred.reject();
300300
}
301301

302302
var validatingRole = Permission.roleValidations[currentRole](toParams, currentRole);

0 commit comments

Comments
 (0)