namespace wcf\action;
use wcf\system\exception\AJAXException;
use wcf\system\exception\IllegalLinkException;
+use wcf\system\exception\NamedUserException;
use wcf\system\exception\LoggedException;
use wcf\system\exception\PermissionDeniedException;
use wcf\system\exception\SystemException;
'fieldName' => $e->getFieldName()
));
}
+ else if ($e instanceof NamedUserException) {
+ throw new AJAXException($e->getMessage(), AJAXException::BAD_PARAMETERS, $e->getTraceAsString());
+ }
else {
throw new AJAXException($e->getMessage(), AJAXException::INTERNAL_ERROR, $e->getTraceAsString(), array(), ($e instanceof LoggedException ? $e->getExceptionID() : ''));
}
public function __construct($message, $errorType = self::INTERNAL_ERROR, $stacktrace = null, $returnValues = array(), $exceptionID = '') {
if ($stacktrace === null) $stacktrace = $this->getTraceAsString();
+ $responseData = array(
+ 'code' => $errorType,
+ 'message' => $message,
+ 'returnValues' => $returnValues
+ );
+
if (WCF::debugModeIsEnabled()) {
- $responseData = array(
- 'message' => $message,
- 'stacktrace' => nl2br($stacktrace)
- );
- }
- else {
- $responseData = array(
- 'message' => $this->_getMessage()
- );
+ $responseData['stacktrace'] = nl2br($stacktrace);
}
- $responseData['code'] = $errorType;
- $responseData['returnValues'] = $returnValues;
-
$statusHeader = '';
switch ($errorType) {
case self::MISSING_PARAMETERS:
$statusHeader = 'HTTP/1.0 400 Bad Request';
- $responseData['message'] = WCF::getLanguage()->get('wcf.ajax.error.badRequest');
- $this->logError();
+ $responseData['exceptionID'] = $exceptionID;
+ $responseData['message'] = WCF::getLanguage()->get('wcf.ajax.error.badRequest');
break;
case self::SESSION_EXPIRED:
case self::BAD_PARAMETERS:
$statusHeader = 'HTTP/1.0 412 Precondition Failed';
+
+ $responseData['exceptionID'] = $exceptionID;
break;
default: