Merge "Use 406 error instead of 500 error when Service API is not supported"

This commit is contained in:
Zuul 2020-01-09 10:20:09 +00:00 committed by Gerrit Code Review
commit 47574ead00
2 changed files with 6 additions and 1 deletions

View File

@ -43,7 +43,8 @@ class ServicesController(rest.RestController):
LOG.debug("Fetch services.")
if not cfg.CONF.coordination.backend_url:
raise exc.CoordinationException("Service API is not supported.")
raise exc.CoordinationNotSupportedException("Service API "
"is not supported.")
service_coordinator = coordination.get_service_coordinator()

View File

@ -176,6 +176,10 @@ class CoordinationException(MistralException):
http_code = 500
class CoordinationNotSupportedException(MistralException):
http_code = 406
class NotAllowedException(MistralException):
http_code = 403
message = "Operation forbidden (insufficient permissions)"