diff options
Diffstat (limited to 'lib/Controller/JSONHttpErrorTrait.php')
-rw-r--r-- | lib/Controller/JSONHttpErrorTrait.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Controller/JSONHttpErrorTrait.php b/lib/Controller/JSONHttpErrorTrait.php index e3e343f16..5c5d7a8cf 100644 --- a/lib/Controller/JSONHttpErrorTrait.php +++ b/lib/Controller/JSONHttpErrorTrait.php @@ -24,4 +24,19 @@ trait JSONHttpErrorTrait { return new JSONResponse(['message' => $exception->getMessage()], $code); } + + /** + * @param \Exception $exception + * @param int $code + * @return \OCP\AppFramework\Http\JSONResponse + */ + public function errorResponseV2(\Exception $exception, $code) + { + return new JSONResponse([ + 'error' => [ + 'code' => $exception->getCode(), + 'message' => $exception->getMessage() + ] + ], $code); + } } |