1
0
mirror of https://github.com/bitwarden/web synced 2026-01-10 12:33:43 +00:00

better error message handling

This commit is contained in:
Kyle Spearrin
2017-11-28 09:27:44 -05:00
parent 2f13449cb6
commit b411176c8d
4 changed files with 46 additions and 17 deletions

View File

@@ -45,13 +45,9 @@
fileEl.type = '';
fileEl.type = 'file';
fileEl.value = '';
}, function (err) {
if (err) {
validationService.addError(form, 'file', err, true);
}
else {
validationService.addError(form, 'file', 'Something went wrong.', true);
}
}, function (e) {
var errors = validationService.parseErrors(e);
toastr.error(errors.length ? errors[0] : 'An error occurred.');
});
};

View File

@@ -2,7 +2,7 @@
.module('bit.vault')
.controller('vaultController', function ($scope, $uibModal, apiService, $filter, cryptoService, authService, toastr,
cipherService, $q, $localStorage, $timeout, $rootScope, $state, $analytics, constants) {
cipherService, $q, $localStorage, $timeout, $rootScope, $state, $analytics, constants, validationService) {
$scope.loading = true;
$scope.ciphers = [];
$scope.folderCount = 0;
@@ -496,8 +496,9 @@
selectAll(false);
$scope.bulkActionLoading = false;
toastr.success('Items have been deleted!');
}, function () {
toastr.error('An error occurred.');
}, function (e) {
var errors = validationService.parseErrors(e);
toastr.error(errors.length ? errors[0] : 'An error occurred.');
$scope.bulkActionLoading = false;
});
};