diff --git a/endpoints/api/error.py b/endpoints/api/error.py index c11623cd4..6c0cbc65c 100644 --- a/endpoints/api/error.py +++ b/endpoints/api/error.py @@ -17,7 +17,7 @@ def error_view(error_type): @resource('/v1/error/') @path_param('error_type', 'The error code identifying the type of error.') class Error(ApiResource): - """ Resource for manging an organization's teams. """ + """ Resource for Error Descriptions""" schemas = { 'ApiErrorDescription': { 'type': 'object', diff --git a/static/js/app.js b/static/js/app.js index bf72f9194..148b3e4a9 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -211,6 +211,7 @@ quayApp.run(['$location', '$rootScope', 'Restangular', 'UserService', 'PlanServi // Handle session expiration. Restangular.setErrorInterceptor(function(response) { + //TODO: remove check for error_type (old style errors) var invalid_token = response.data['title'] == 'invalid_token' || response.data['error_type'] == 'invalid_token'; if (response.status == 401 && invalid_token && response.data['session_required'] !== false) { $('#sessionexpiredModal').modal({}); diff --git a/static/js/directives/ui/signup-form.js b/static/js/directives/ui/signup-form.js index 50e23a474..03c81a293 100644 --- a/static/js/directives/ui/signup-form.js +++ b/static/js/directives/ui/signup-form.js @@ -46,7 +46,7 @@ angular.module('quay').directive('signupForm', function () { UserService.load(); }, function(result) { $scope.registering = false; - UIService.showFormError('#signupButton', result); + UIService.showFormError('#signupButton', result, null, ApiService); }); }; } diff --git a/static/js/services/api-service.js b/static/js/services/api-service.js index 6ea64492d..311879661 100644 --- a/static/js/services/api-service.js +++ b/static/js/services/api-service.js @@ -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; } diff --git a/static/js/services/ui-service.js b/static/js/services/ui-service.js index ebc374307..6893abd32 100644 --- a/static/js/services/ui-service.js +++ b/static/js/services/ui-service.js @@ -1,7 +1,7 @@ /** * Service which provides helper methods for performing some simple UI operations. */ -angular.module('quay').factory('UIService', ['$timeout', '$rootScope', '$location', function($timeout, $rootScope, $location) { +angular.module('quay').factory('UIService', ['$timeout', '$rootScope', '$location', 'ApiService', function($timeout, $rootScope, $location, ApiService) { var CheckStateController = function(items, itemKey) { this.items = items; this.checked = []; @@ -12,6 +12,7 @@ angular.module('quay').factory('UIService', ['$timeout', '$rootScope', '$locatio this.itemKey_ = itemKey; this.listeners_ = []; this.page_ = null; + this.ApiService = ApiService }; CheckStateController.prototype.listen = function(callback) { @@ -138,7 +139,7 @@ angular.module('quay').factory('UIService', ['$timeout', '$rootScope', '$locatio }; uiService.showFormError = function(elem, result, opt_placement) { - var message = result.data['message'] || result.data['error_description'] || result.data['detail'] || ''; + var message = ApiService.getErrorMessage(result, 'error'); if (message) { uiService.showPopover(elem, message, opt_placement || 'bottom'); } else {