Stop wrapping selected exceptions into an AJAXException
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 13 Apr 2023 14:22:36 +0000 (16:22 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 14 Apr 2023 11:54:50 +0000 (13:54 +0200)
These exceptions are converted into clean responses using the HandleExceptions
middleware.

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

index 8ea381e979bc3652bb5830c287bcd7c9d231e419..edefd92ce4c6061d33083f60801a887230f2ad69 100644 (file)
@@ -33,35 +33,11 @@ trait TAJAXException
     protected function throwException($e)
     {
         if ($e instanceof InvalidSecurityTokenException) {
-            throw new AJAXException(
-                WCF::getLanguage()->getDynamicVariable('wcf.ajax.error.sessionExpired'),
-                AJAXException::SESSION_EXPIRED,
-                $e->getTraceAsString(),
-                [
-                    'file' => $e->getFile(),
-                    'line' => $e->getLine(),
-                ]
-            );
+            throw $e;
         } elseif ($e instanceof PermissionDeniedException) {
-            throw new AJAXException(
-                WCF::getLanguage()->getDynamicVariable('wcf.ajax.error.permissionDenied'),
-                AJAXException::INSUFFICIENT_PERMISSIONS,
-                $e->getTraceAsString(),
-                [
-                    'file' => $e->getFile(),
-                    'line' => $e->getLine(),
-                ]
-            );
+            throw $e;
         } elseif ($e instanceof IllegalLinkException) {
-            throw new AJAXException(
-                WCF::getLanguage()->get('wcf.ajax.error.illegalLink'),
-                AJAXException::ILLEGAL_LINK,
-                $e->getTraceAsString(),
-                [
-                    'file' => $e->getFile(),
-                    'line' => $e->getLine(),
-                ]
-            );
+            throw $e;
         } elseif ($e instanceof UserInputException) {
             // repackage as ValidationActionException
             $exception = new ValidateActionException($e->getField(), $e->getType(), $e->getVariables());