瀏覽代碼

Fix throwable, with a useful server-error

Joachim M. Giæver 2 年之前
父節點
當前提交
dbc4cd679f
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      src/Client.php

+ 8 - 1
src/Client.php

@@ -79,7 +79,14 @@ final class Client {
                 'json' => $prospectus->toPostParams(),
                 'json' => $prospectus->toPostParams(),
             ]
             ]
         );
         );
-        var_dump($ret->getContent(false));
+        try {
+            $ret->getContent();
+            return true;
+        } catch (\Exception $e) {
+            $content = $ret->getContent(false);
+            throw new \InvalidArgumentException(!empty($content) ? $content : $e->getMessage(), $e->getCode(), $e);
+        }
+
         return false;
         return false;
     }
     }
 }
 }