From 55556bab75d70341e3ec00575248238d0e6ae0c9 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 3 Feb 2014 02:26:29 +0100 Subject: [PATCH 1/3] use json instead of raw error msg output --- ajax/otpoll.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ajax/otpoll.php b/ajax/otpoll.php index e3d7c0af..64706929 100644 --- a/ajax/otpoll.php +++ b/ajax/otpoll.php @@ -109,8 +109,8 @@ try{ \OCP\JSON::success($response); } catch (BadRequestException $e){ header('HTTP/1.1 400: BAD REQUEST'); - print(""); - print($e->getBody()); - print(""); + \OCP\JSON::error( array( + 'message' => $e->getBody(), + )); } exit(); From 8badfa24b55176e0cf4cf09b5fb45eb7cc91d350 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 4 Feb 2014 19:09:26 +0100 Subject: [PATCH 2/3] use err instead of message --- ajax/otpoll.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ajax/otpoll.php b/ajax/otpoll.php index 64706929..847d4ae2 100644 --- a/ajax/otpoll.php +++ b/ajax/otpoll.php @@ -110,7 +110,7 @@ try{ } catch (BadRequestException $e){ header('HTTP/1.1 400: BAD REQUEST'); \OCP\JSON::error( array( - 'message' => $e->getBody(), + 'err' => $e->getBody(), )); } exit(); From 9e4b196736517169d495c7a1c6f7e988cc3221c3 Mon Sep 17 00:00:00 2001 From: Victor Dubiniuk Date: Tue, 4 Feb 2014 21:40:51 +0300 Subject: [PATCH 3/3] Remove excessive encoding --- ajax/otpoll.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ajax/otpoll.php b/ajax/otpoll.php index 847d4ae2..6a83f824 100644 --- a/ajax/otpoll.php +++ b/ajax/otpoll.php @@ -39,7 +39,7 @@ try{ } catch (\Exception $e){ Helper::warnLog('Error. Session no longer exists. ' . $e->getMessage()); $ex = new BadRequestException(); - $ex->setBody("{err:'bad request: [" . $request->getRawRequest() . "]'}"); + $ex->setBody($request->getRawRequest()); throw $ex; } if (!$file->isPublicShare()){ @@ -101,7 +101,7 @@ try{ break; default: $ex = new BadRequestException(); - $ex->setBody("{err:'bad request: [" . $request->getRawRequest() . "]'}"); + $ex->setBody($request->getRawRequest()); throw $ex; break; } @@ -110,7 +110,7 @@ try{ } catch (BadRequestException $e){ header('HTTP/1.1 400: BAD REQUEST'); \OCP\JSON::error( array( - 'err' => $e->getBody(), + 'err' => 'bad request:[' . $e->getBody() . ']', )); } exit();