Skip to content

Commit 953d338

Browse files
Merge pull request #145 from php-http/clarify-error-plugin
clarify use case of error plugin
2 parents 3c8a0d5 + 15a9773 commit 953d338

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

plugins/error.rst

+6
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@ and the response coming from them::
3030
// Something has not been found
3131
}
3232
}
33+
34+
The error plugin is intended for when an application operates with the client directly. When
35+
writing a library around an API, the best practice is to have the client convert responses into
36+
domain objects, and transform HTTP errors into meaningful domain exceptions. In that scenario,
37+
the ErrorPlugin is not needed. It is more efficient to check the HTTP status codes yourself than
38+
throwing and catching exceptions.

0 commit comments

Comments
 (0)