瀏覽代碼

Add more information about the error in the bbcode structure

Visman 3 年之前
父節點
當前提交
bfb4c413bd
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      app/Models/BBCodeList/Update.php

+ 3 - 2
app/Models/BBCodeList/Update.php

@@ -14,6 +14,7 @@ use ForkBB\Models\Method;
 use ForkBB\Models\BBCodeList\BBCodeList;
 use ForkBB\Models\BBCodeList\Structure;
 use RuntimeException;
+use function \ForkBB\__;
 
 class Update extends Method
 {
@@ -22,8 +23,8 @@ class Update extends Method
      */
     public function update(int $id, Structure $structure): BBCodeList
     {
-        if (null !== $structure->getError()) {
-            throw new RuntimeException('BBCode structure has error');
+        if (null !== ($error = $structure->getError())) {
+            throw new RuntimeException('BBCode structure has error (' . __($error) . ')');
         }
 
         $vars = [