From 39cabbbb2f0f0ad567b66ba1ebf956a85b117779 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 3 May 2012 15:24:25 +0200 Subject: [PATCH] Improved exceptions and added language variables --- wcfsetup/install/files/lib/action/AJAXProxyAction.class.php | 4 ++-- .../files/lib/system/exception/AJAXException.class.php | 4 ++++ wcfsetup/install/lang/de.xml | 4 ++++ wcfsetup/install/lang/en.xml | 4 ++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/action/AJAXProxyAction.class.php b/wcfsetup/install/files/lib/action/AJAXProxyAction.class.php index e8ba240d33..1f6264ef8f 100644 --- a/wcfsetup/install/files/lib/action/AJAXProxyAction.class.php +++ b/wcfsetup/install/files/lib/action/AJAXProxyAction.class.php @@ -149,10 +149,10 @@ class AJAXProxyAction extends AbstractSecureAction { */ protected function throwException(\Exception $e) { if ($e instanceof IllegalLinkException) { - throw new AJAXException(WCF::getLanguage()->get('wcf.global.error.sessionExpired'), AJAXException::SESSION_EXPIRED); + throw new AJAXException(WCF::getLanguage()->get('wcf.global.ajax.error.sessionExpired'), AJAXException::SESSION_EXPIRED); } else if ($e instanceof PermissionDeniedException) { - throw new AJAXException(WCF::getLanguage()->get('wcf.global.error.permissionDenied'), AJAXException::INSUFFICIENT_PERMISSIONS); + throw new AJAXException(WCF::getLanguage()->get('wcf.global.ajax.error.permissionDenied'), AJAXException::INSUFFICIENT_PERMISSIONS); } else if ($e instanceof SystemException) { throw new AJAXException($e->getMessage(), AJAXException::INTERNAL_ERROR, $e->__getTraceAsString()); diff --git a/wcfsetup/install/files/lib/system/exception/AJAXException.class.php b/wcfsetup/install/files/lib/system/exception/AJAXException.class.php index 6be6ad065b..eecd80e892 100644 --- a/wcfsetup/install/files/lib/system/exception/AJAXException.class.php +++ b/wcfsetup/install/files/lib/system/exception/AJAXException.class.php @@ -71,6 +71,7 @@ class AJAXException extends LoggedException { switch ($errorType) { case self::MISSING_PARAMETERS: $statusHeader = 'HTTP/1.0 400 Bad Request'; + $responseData['message'] = WCF::getLanguage()->get('wcf.global.ajax.error.badRequest'); $this->logError(); break; @@ -93,6 +94,9 @@ class AJAXException extends LoggedException { header('HTTP/1.0 503 Service Unavailable'); $responseData['code'] = self::INTERNAL_ERROR; + if (!WCF::debugModeIsEnabled()) { + $responseData['message'] = WCF::getLanguage()->get('wcf.global.ajax.error.internalError'); + } $this->logError(); break; diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 3e1f354b15..d9824a7453 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -566,6 +566,10 @@ + + + + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index f4dd29f403..63fbae4a4a 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -533,6 +533,10 @@ + + + + -- 2.20.1