소스 검색

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(),
             ]
         );
-        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;
     }
 }