]> BookStack Code Mirror - bookstack/blobdiff - app/Exceptions/NotifyException.php
Addressed test failures from users API changes
[bookstack] / app / Exceptions / NotifyException.php
index e09247208fc7d432e84932c97c3252e3bda8f124..ced4780900669897d2a9a8b18b5791968287613f 100644 (file)
@@ -39,6 +39,11 @@ class NotifyException extends Exception implements Responsable
     {
         $message = $this->getMessage();
 
+        // Front-end JSON handling. API-side handling managed via handler.
+        if ($request->wantsJson()) {
+            return response()->json(['error' => $message], 403);
+        }
+
         if (!empty($message)) {
             session()->flash('error', $message);
         }