Added handler for 412 Precondition Failed from SDK.

This commit is contained in:
Sybren A. Stüvel 2016-09-22 18:09:38 +02:00
parent 9514066893
commit 0f23ee7a08
3 changed files with 25 additions and 0 deletions

View File

@ -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)

View 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 %}

View 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.