better error reporting in cherrypy

This commit is contained in:
Thomas Phipps 2023-03-07 19:00:50 +00:00 committed by Pedro Algarvio
parent 021a028a3e
commit 443a1be16c

View file

@ -863,10 +863,12 @@ def hypermedia_handler(*args, **kwargs):
salt.exceptions.AuthorizationError,
salt.exceptions.EauthAuthenticationError,
salt.exceptions.TokenAuthenticationError,
):
raise cherrypy.HTTPError(401)
except salt.exceptions.SaltInvocationError:
raise cherrypy.HTTPError(400)
) as e:
logger.error(e.message)
raise cherrypy.HTTPError(401, e.message)
except salt.exceptions.SaltInvocationError as e:
logger.error(e.message)
raise cherrypy.HTTPError(400, e.message)
except (
salt.exceptions.SaltDaemonNotRunning,
salt.exceptions.SaltReqTimeoutError,