@@ -51,13 +51,13 @@ or `ServerException` (for 5xx errors).
5151
5252``` php
5353try {
54- $forms = $api->add_subscriber_to_form('invalid-form-id');
54+ $forms = $api->add_subscriber_to_form('invalid-form-id');
5555} catch (GuzzleHttp\Exception\ClientException $e) {
56- // Handle 4xx client errors.
56+ // Handle 4xx client errors.
5757 die($e->getMessage());
5858} catch (GuzzleHttp\Exception\ServerException $e) {
59- // Handle 5xx server errors.
60- die($e->getMessage());
59+ // Handle 5xx server errors.
60+ die($e->getMessage());
6161}
6262```
6363
@@ -66,16 +66,16 @@ For a more detailed error message, it's possible to fetch the API's response whe
6666``` php
6767// Errors will be thrown as Guzzle's ClientException or ServerException.
6868try {
69- $forms = $api->form_subscribe('invalid-form-id');
69+ $forms = $api->form_subscribe('invalid-form-id');
7070} catch (GuzzleHttp\Exception\ClientException $e) {
71- // Handle 4xx client errors.
72- // For ClientException, it's possible to inspect the API's JSON response
73- // to output an error or handle it accordingly.
71+ // Handle 4xx client errors.
72+ // For ClientException, it's possible to inspect the API's JSON response
73+ // to output an error or handle it accordingly.
7474 $error = json_decode($e->getResponse()->getBody()->getContents());
7575 die($error->message); // e.g. "Entity not found".
7676} catch (GuzzleHttp\Exception\ServerException $e) {
77- // Handle 5xx server errors.
78- die($e->getMessage());
77+ // Handle 5xx server errors.
78+ die($e->getMessage());
7979}
8080```
8181
0 commit comments