From e9200f7210f3d3a00ccbf0748c76f3988ce82018 Mon Sep 17 00:00:00 2001 From: Andrea Marco Sartori Date: Tue, 10 Sep 2024 20:13:42 -0300 Subject: [PATCH] Update readme --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5178936..0298050 100644 --- a/README.md +++ b/README.md @@ -343,8 +343,8 @@ use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; LazyJsonPages::from($source) - ->onRequest(fn (RequestInterface $request) => ...) - ->onResponse(fn (ResponseInterface $response, RequestInterface $request) => ...); + ->onRequest(fn(RequestInterface $request) => ...) + ->onResponse(fn(ResponseInterface $response, RequestInterface $request) => ...); ``` We can also tweak the number of allowed seconds before an API connection times out or the allowed duration of the entire HTTP request (by default they are both set to 5 seconds): @@ -361,7 +361,7 @@ If the 3rd party API is faulty or error-prone, we can indicate how many times we // repeat failing requests 5 times after a backoff of 1, 2, 3, 4 and 5 seconds LazyJsonPages::from($source) ->attempts(5) - ->backoff(fn (int $attempt) => $attempt * 1000); + ->backoff(fn(int $attempt) => $attempt * 1000); ``` ### 💢 Errors handling @@ -373,7 +373,7 @@ use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; LazyJsonPages::from($source) - ->onError(fn (Throwable $e, RequestInterface $request, ?ResponseInterface $response) => ...); + ->onError(fn(Throwable $e, RequestInterface $request, ?ResponseInterface $response) => ...); ``` Any exception thrown by this package extends the `LazyJsonPagesException` class. This makes it easy to handle all exceptions in a single catch block: