Use ApiService to get error message
This commit is contained in:
parent
b5db41920f
commit
7c361c07f9
5 changed files with 8 additions and 4 deletions
|
|
@ -124,6 +124,7 @@ angular.module('quay').factory('ApiService', ['Restangular', '$q', 'UtilService'
|
|||
var deferred = $q.defer();
|
||||
|
||||
// If the error is a fresh login required, show the dialog.
|
||||
// TODO: remove error_type (old style error)
|
||||
var fresh_login_required = resp.data['title'] == 'fresh_login_required' || resp.data['error_type'] == 'fresh_login_required';
|
||||
if (resp.status == 401 && fresh_login_required) {
|
||||
var retryOperation = function() {
|
||||
|
|
@ -294,6 +295,7 @@ angular.module('quay').factory('ApiService', ['Restangular', '$q', 'UtilService'
|
|||
apiService.getErrorMessage = function(resp, defaultMessage) {
|
||||
var message = defaultMessage;
|
||||
if (resp['data']) {
|
||||
//TODO: remove error_message and error_description (old style error)
|
||||
message = resp['data']['detail'] || resp['data']['error_message'] || resp['data']['message'] || resp['data']['error_description'] || message;
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue