Browse Source

Fix throwable, with a useful server-error

Joachim M. Giæver 2 years ago
parent
commit
dbc4cd679f
1 changed files with 8 additions and 1 deletions
  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;
     }
 }