Browse Source

:construction: 异常处理优化

jqh 4 years ago
parent
commit
eedad5b01a
1 changed files with 19 additions and 1 deletions
  1. 19 1
      src/Layout/Content.php

+ 19 - 1
src/Layout/Content.php

@@ -270,10 +270,28 @@ class Content implements Renderable
 
             return $html;
         } catch (\Throwable $e) {
-            return Admin::handleException($e);
+            return $this->handleException($e);
         }
     }
 
+    /**
+     * @param \Throwable $e
+     *
+     * @return mixed|string
+     */
+    protected function handleException(\Throwable $e)
+    {
+        $response = Admin::handleException($e);
+
+        if (is_string($response) || $response instanceof Renderable) {
+            $row = new Row($response);
+
+            return $row->render();
+        }
+
+        return $response;
+    }
+
     /**
      * Set success message for content.
      *