You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bf9822f
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: CHANGELOG.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,12 @@
1
1
# Saborter Changelog
2
2
3
+
## v2.4.0 (April 23th, 2026)
4
+
5
+
### New Features
6
+
7
+
- Added `isTimeoutError` function to determine whether the given error is a timeout error [#80](https://github.com/TENSIILE/saborter/pull/82/changes/9adbc0237df3944b21cb60488105b0238d36d10d)
8
+
- Added `Provision API` that injects the `Aborter` context into the `Http API`[#81](https://github.com/TENSIILE/saborter/pull/82/changes/7b9a6ce4f8050aceb6c3e1c13d93a42c41b9a497)
Copy file name to clipboardExpand all lines: docs/libs.md
+33-2Lines changed: 33 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -115,6 +115,37 @@ try {
115
115
}
116
116
```
117
117
118
+
### `isTimeoutError`
119
+
120
+
This function determines whether a given error represents a timeout‑induced abort error. It checks that the error is an `AbortError`, its initiator property is exactly `'timeout'`, and its `cause` is an instance of `TimeoutError`. This is useful for distinguishing timeouts from other abort reasons (e.g., user cancellation or system aborts).
121
+
122
+
**Parameters:**
123
+
124
+
-`error: any` - The error object to inspect.
125
+
126
+
**Returns:**
127
+
128
+
`error is TimeoutError`
129
+
130
+
- Returns `true` if the error is an `AbortError` with `initiator === 'timeout'` and `cause instanceof TimeoutError`.
131
+
- Returns `false` otherwise.
132
+
133
+
**Example:**
134
+
135
+
```typescript
136
+
try {
137
+
awaitabortableRequest();
138
+
} catch (error) {
139
+
if (isTimeoutError(error)) {
140
+
console.log('Request timed out');
141
+
// Handle timeout gracefully
142
+
} else {
143
+
// Re‑throw other errors
144
+
throwerror;
145
+
}
146
+
}
147
+
```
148
+
118
149
### `debounce`
119
150
120
151
Creates a debounced function that delays invoking the provided handler until after a specified timeout has elapsed since the last call. This is a leading‑edge debounce – the first call in a burst schedules the execution, and subsequent calls reset the timer. The debounced function accepts an `AbortSignal` and returns a promise that resolves with the handler's result or rejects if the handler throws or the signal is aborted.
@@ -126,7 +157,7 @@ Creates a debounced function that delays invoking the provided handler until aft
126
157
127
158
**Returns:**
128
159
129
-
`(signal: AbortSignal) => R | Promise<R>`
160
+
`(signal: AbortSignal) => Promise<R>`
130
161
131
162
A function that accepts an `AbortSignal` and returns a `Promise<R>`, where `R` is the return type of the handler.
132
163
@@ -210,7 +241,7 @@ Schedules the execution of a handler after a specified delay. The operation can
210
241
211
242
**Parameters:**
212
243
213
-
-`handler: ((signal: AbortSignal) => T | Promise<T>)`:
244
+
-`handler: ((signal: AbortSignal, requestOptions: AbortableRequestOptions) => T | Promise<T>)`:
214
245
- A function that accepts an `AbortSignal` and returns a value or a `Promise`. This function will be called with the signal to allow cleanup on abort.
215
246
-`delay?: number` - The time in milliseconds to wait before executing the handler. If omitted, the handler is scheduled without a delay (i.e., as soon as possible).
0 commit comments