diff options
author | Joas Schilling <coding@schilljs.com> | 2021-10-22 11:26:18 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-10-22 11:26:18 +0200 |
commit | c160668b0721434fd9e79b6a3018111bad6db586 (patch) | |
tree | e35d9547b79e0e80fb4cdbb92b7d853428725416 | |
parent | fb18f291488c706abcc58f365fe71e7ece2fca39 (diff) | |
download | nextcloud-server-c160668b0721434fd9e79b6a3018111bad6db586.tar.gz nextcloud-server-c160668b0721434fd9e79b6a3018111bad6db586.zip |
Return 500 and the exception message (on debug) on OCS
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | ocs/v1.php | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/ocs/v1.php b/ocs/v1.php index d596a1b0fd3..9f6a05ac42f 100644 --- a/ocs/v1.php +++ b/ocs/v1.php @@ -79,7 +79,13 @@ try { OC_API::setContentType(); $format = \OC::$server->getRequest()->getParam('format', 'xml'); - $txt = 'Invalid query, please check the syntax. API specifications are here:' - .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n"; - OC_API::respond(new \OC\OCS\Result(null, \OCP\AppFramework\OCSController::RESPOND_NOT_FOUND, $txt), $format); + $txt = 'Internal Server Error'."\n"; + try { + if (\OC::$server->getSystemConfig()->getValue('debug', false)) { + $txt .= $e->getMessage(); + } + } catch (\Throwable $e) { + // Just to be save + } + OC_API::respond(new \OC\OCS\Result(null, \OCP\AppFramework\OCSController::RESPOND_SERVER_ERROR, $txt), $format); } |