Added handler for 412 Precondition Failed from SDK.
This commit is contained in:
parent
9514066893
commit
0f23ee7a08
@ -317,6 +317,7 @@ class PillarServer(Eve):
|
||||
(sdk_exceptions.ResourceNotFound, self.handle_sdk_resource_not_found),
|
||||
(sdk_exceptions.ResourceInvalid, self.handle_sdk_resource_invalid),
|
||||
(sdk_exceptions.MethodNotAllowed, self.handle_sdk_method_not_allowed),
|
||||
(sdk_exceptions.PreconditionFailed, self.handle_sdk_precondition_failed),
|
||||
]
|
||||
|
||||
for (eclass, handler) in sdk_handlers:
|
||||
@ -341,6 +342,12 @@ class PillarServer(Eve):
|
||||
error.code = 404
|
||||
return self.pillar_error_handler(error)
|
||||
|
||||
def handle_sdk_precondition_failed(self, error):
|
||||
self.log.info('Forwarding PreconditionFailed exception to client: %s', error, exc_info=True)
|
||||
|
||||
error.code = 412
|
||||
return self.pillar_error_handler(error)
|
||||
|
||||
def handle_sdk_resource_invalid(self, error):
|
||||
self.log.info('Forwarding ResourceInvalid exception to client: %s', error, exc_info=True)
|
||||
|
||||
|
11
src/templates/errors/412.jade
Normal file
11
src/templates/errors/412.jade
Normal file
@ -0,0 +1,11 @@
|
||||
| {% extends "errors/layout.html" %}
|
||||
| {% block body %}
|
||||
#error_container.412.standalone
|
||||
#error_box
|
||||
.error-title 412. Precondition Failed.
|
||||
|
||||
.error-lead.
|
||||
Someone else also edited the thing you're trying to edit.
|
||||
Reload and try again.
|
||||
|
||||
| {% endblock %}
|
7
src/templates/errors/412_embed.jade
Normal file
7
src/templates/errors/412_embed.jade
Normal file
@ -0,0 +1,7 @@
|
||||
#error_container.412
|
||||
#error_box
|
||||
.error-title 412. Precondition Failed.
|
||||
|
||||
.error-lead.
|
||||
Someone else also edited the thing you're trying to edit.
|
||||
Reload and try again.
|
Loading…
x
Reference in New Issue
Block a user