Expose the real validation exception message via Ajax
authorAlexander Ebert <ebert@woltlab.com>
Fri, 9 Jun 2017 12:56:53 +0000 (14:56 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 9 Jun 2017 12:56:53 +0000 (14:56 +0200)
See #2299

wcfsetup/install/files/lib/action/AJAXInvokeAction.class.php

index 1534fa95402d58e71fe3b500b2d5f5e905137134..5458bc1c70de20cd594f7ddfe3469537db04cf9a 100644 (file)
@@ -35,7 +35,7 @@ class AJAXInvokeAction extends AbstractSecureAction {
         * action object
         * @var SingletonFactory
         */
-       public $actionObject = null;
+       public $actionObject;
        
        /**
         * class name
@@ -53,7 +53,7 @@ class AJAXInvokeAction extends AbstractSecureAction {
         * results of the executed action
         * @var mixed
         */
-       protected $response = null;
+       protected $response;
        
        /**
         * @inheritDoc
@@ -189,13 +189,15 @@ class AJAXInvokeAction extends AbstractSecureAction {
                        throw new AJAXException($exception->getMessage(), AJAXException::BAD_PARAMETERS, $e->getTraceAsString(), [
                                'errorMessage' => $exception->getMessage(),
                                'errorType' => $e->getType(),
-                               'fieldName' => $exception->getFieldName()
+                               'fieldName' => $exception->getFieldName(),
+                               'realErrorMessage' => $exception->getErrorMessage()
                        ]);
                }
                else if ($e instanceof ValidateActionException) {
                        throw new AJAXException($e->getMessage(), AJAXException::BAD_PARAMETERS, $e->getTraceAsString(), [
                                'errorMessage' => $e->getMessage(),
-                               'fieldName' => $e->getFieldName()
+                               'fieldName' => $e->getFieldName(),
+                               'realErrorMessage' => $e->getErrorMessage()
                        ]);
                }
                else if ($e instanceof NamedUserException) {