Return a dict structure to the API for ValidationErrors, for easier error identification/interface

This commit is contained in:
Alexandre Aubin 2021-04-10 15:24:22 +02:00
parent 64c6d7aa64
commit 442a1cf96d

View file

@ -48,7 +48,7 @@ class YunohostError(MoulinetteError):
def content(self):
if not self.log_ref:
return super(YunohostError, self).content()
return super().content()
else:
return {"error": self.strerror, "log_ref": self.log_ref}
@ -56,3 +56,7 @@ class YunohostError(MoulinetteError):
class YunohostValidationError(YunohostError):
http_code = 400
def content(self):
return {"error": self.strerror, "error_key": self.key}