Use new error format for auth errors (factor exceptions into module)

This commit is contained in:
Evan Cordell 2016-04-11 16:20:11 -04:00
parent 9c08717173
commit eba75494d9
25 changed files with 214 additions and 177 deletions

View file

@ -2,9 +2,9 @@
from flask import url_for
from enum import Enum
from endpoints.api import (resource, nickname, ApiResource, NotFound, path_param,
define_json_response, ApiErrorType, ERROR_DESCRIPTION)
from endpoints.api import (resource, nickname, ApiResource, path_param,
define_json_response)
from endpoints.exception import NotFound, ApiErrorType, ERROR_DESCRIPTION
def error_view(error_type):
return {
@ -19,12 +19,12 @@ def error_view(error_type):
class Error(ApiResource):
""" Resource for manging an organization's teams. """
schemas = {
'ApiError': {
'ApiErrorDescription': {
'type': 'object',
'description': 'Description of an error',
'required': [
'type',
'properties',
'description',
'title',
],
'properties': {
@ -45,8 +45,8 @@ class Error(ApiResource):
},
}
@define_json_response('ApiError')
@nickname('getError')
@define_json_response('ApiErrorDescription')
@nickname('getErrorDescription')
def get(self, error_type):
""" Get a detailed description of the error """
if error_type in ERROR_DESCRIPTION.keys():