committed by
Julius Härtl
parent
1e3ff41cb2
commit
725f99d8b8
@@ -25,6 +25,7 @@ namespace OCA\Deck\Middleware;
|
||||
|
||||
use OCA\Deck\Controller\PageController;
|
||||
use OCA\Deck\StatusException;
|
||||
use OCA\Deck\Exceptions\ConflictException;
|
||||
use OCP\AppFramework\Db\DoesNotExistException;
|
||||
use OCP\AppFramework\Middleware;
|
||||
use OCP\AppFramework\Http\JSONResponse;
|
||||
@@ -63,6 +64,17 @@ class ExceptionMiddleware extends Middleware {
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function afterException($controller, $methodName, \Exception $exception) {
|
||||
if ($exception instanceof ConflictException) {
|
||||
if ($this->config->getSystemValue('loglevel', Util::WARN) === Util::DEBUG) {
|
||||
$this->logger->logException($exception);
|
||||
}
|
||||
return new JSONResponse([
|
||||
'status' => $exception->getStatus(),
|
||||
'message' => $exception->getMessage(),
|
||||
'data' => $exception->getData(),
|
||||
], $exception->getStatus());
|
||||
}
|
||||
|
||||
if ($exception instanceof StatusException) {
|
||||
if ($this->config->getSystemValue('loglevel', Util::WARN) === Util::DEBUG) {
|
||||
$this->logger->logException($exception);
|
||||
|
||||
Reference in New Issue
Block a user