-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Another potentially useful trigger for automatically aborting an HTTP request is a timeout value: If the call takes too long, let's bale out of it and inform the user.
Sample usage:
import { abortableRootFetcher, AbortReason } from './root-fetchers.js';
const response = await abortableRootFetcher
.for<200, ...>()
.get('/some/url', { autoAbort: { key: 'abc', timeout: 3_000 }});
if (response.aborted) {
if (response.error.cause === AbortReason.timeout) {
// Show the user a specialized message/UI.
}
}Here, AbortReason is an enumeration that developers can use to know the exact reason of the abortion.
Metadata
Metadata
Assignees
Labels
No labels