Skip to content

Commit a569068

Browse files
committed
improve readme
1 parent 5bbe208 commit a569068

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,14 @@ const datasource = new (class MoviesAPI extends HTTPDataSource {
8282
// cancel all running requests e.g when request is closed prematurely
8383
datasource.abort()
8484
```
85+
86+
## Hooks
87+
88+
- `onCacheKeyCalculation` - Returns the cache key for request memoization.
89+
- `onRequestError` - Is executed only for request errors.
90+
- `beforeRequest` - Is executed before a request is executed.
91+
- `onResponse` - Is executed on a successful response.
92+
93+
## Error handling
94+
95+
The http client throws for unsuccessful responses. Every error is rethrown to the caller. You can use the `onRequestError` hook to log request errors.

0 commit comments

Comments
 (0)