heat.api.middleware.fault module

A middleware that turns exceptions into parsable string.

Inspired by Cinder’s faultwrapper.

class heat.api.middleware.fault.Fault(error)[source]

Bases: object

class heat.api.middleware.fault.FaultWrapper(application)[source]

Bases: heat.common.wsgi.Middleware

Replace error body with something the client can parse.

error_map = {'ActionInProgress': <class 'webob.exc.HTTPConflict'>, 'AttributeError': <class 'webob.exc.HTTPBadRequest'>, 'CircularDependencyException': <class 'webob.exc.HTTPBadRequest'>, 'DownloadLimitExceeded': <class 'webob.exc.HTTPBadRequest'>, 'EntityNotFound': <class 'webob.exc.HTTPNotFound'>, 'EventSendFailed': <class 'webob.exc.HTTPInternalServerError'>, 'Forbidden': <class 'webob.exc.HTTPForbidden'>, 'ImmutableParameterModified': <class 'webob.exc.HTTPBadRequest'>, 'IncompatibleObjectVersion': <class 'webob.exc.HTTPBadRequest'>, 'Invalid': <class 'webob.exc.HTTPBadRequest'>, 'InvalidBreakPointHook': <class 'webob.exc.HTTPBadRequest'>, 'InvalidEncryptionKey': <class 'webob.exc.HTTPInternalServerError'>, 'InvalidGlobalResource': <class 'webob.exc.HTTPInternalServerError'>, 'InvalidSchemaError': <class 'webob.exc.HTTPBadRequest'>, 'InvalidTemplateReference': <class 'webob.exc.HTTPBadRequest'>, 'InvalidTemplateSection': <class 'webob.exc.HTTPBadRequest'>, 'InvalidTemplateVersion': <class 'webob.exc.HTTPBadRequest'>, 'InvalidTenant': <class 'webob.exc.HTTPForbidden'>, 'MissingCredentialError': <class 'webob.exc.HTTPBadRequest'>, 'NotFound': <class 'webob.exc.HTTPNotFound'>, 'NotSupported': <class 'webob.exc.HTTPBadRequest'>, 'ObjectActionError': <class 'webob.exc.HTTPBadRequest'>, 'ObjectFieldInvalid': <class 'webob.exc.HTTPBadRequest'>, 'OrphanedObjectError': <class 'webob.exc.HTTPBadRequest'>, 'PhysicalResourceIDAmbiguity': <class 'webob.exc.HTTPBadRequest'>, 'PhysicalResourceNameAmbiguity': <class 'webob.exc.HTTPBadRequest'>, 'PropertyUnspecifiedError': <class 'webob.exc.HTTPBadRequest'>, 'ReadOnlyFieldError': <class 'webob.exc.HTTPBadRequest'>, 'RequestLimitExceeded': <class 'webob.exc.HTTPBadRequest'>, 'ResourceActionNotSupported': <class 'webob.exc.HTTPBadRequest'>, 'ResourceNotAvailable': <class 'webob.exc.HTTPNotFound'>, 'ResourcePropertyConflict': <class 'webob.exc.HTTPBadRequest'>, 'ResourceTypeUnavailable': <class 'webob.exc.HTTPBadRequest'>, 'RevertFailed': <class 'webob.exc.HTTPInternalServerError'>, 'ServerBuildFailed': <class 'webob.exc.HTTPInternalServerError'>, 'StackExists': <class 'webob.exc.HTTPConflict'>, 'StackValidationFailed': <class 'webob.exc.HTTPBadRequest'>, 'StopActionFailed': <class 'webob.exc.HTTPInternalServerError'>, 'UnknownUserParameter': <class 'webob.exc.HTTPBadRequest'>, 'UnsupportedObjectError': <class 'webob.exc.HTTPBadRequest'>, 'UserParameterMissing': <class 'webob.exc.HTTPBadRequest'>, 'ValueError': <class 'webob.exc.HTTPBadRequest'>}
process_request(req)[source]

Called on each request.

If this returns None, the next application down the stack will be executed. If it returns a response then that response will be returned and execution will stop here.