Skip to content

Commit

Permalink
Hide isAbortError from public API
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkamyshev committed Oct 27, 2023
1 parent 7991fa8 commit 67d7288
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/loud-pumas-chew.md
@@ -0,0 +1,5 @@
---
'@farfetched/core': minor
---

Hide `isAbortError` from public API
13 changes: 0 additions & 13 deletions apps/website/docs/api/utils/error_guards.md
Expand Up @@ -30,19 +30,6 @@ const timedOut = sample({
});
```

## `isAbortError`

`AbortError` is thrown when the query is aborted.

```ts
import { isAbortError } from '@farfetched/core';

const aborted = sample({
clock: query.finished.failure,
filter: isAbortError,
});
```

## `isPreparationError`

Preparation error is thrown when the response cannot be prepared for some reason. For example, when the response is not a JSON string, but supposed to be.
Expand Down
6 changes: 6 additions & 0 deletions apps/website/docs/releases/0-11.md
@@ -1,3 +1,9 @@
# v0.11

## Migration guide

### Delete `isAbortError`

Since [v0.10](/releases/0-10) aborted [_Queries_](/api/primitives/query) and [_Mutations_](/api/primitives/mutations) are not treated as failed anymore. So, `isAbortError` is not needed can be safely removed from your codebase.

<!--@include: ./0-11.changelog.md-->
1 change: 0 additions & 1 deletion packages/core/index.ts
Expand Up @@ -89,7 +89,6 @@ export {
} from './src/errors/create_error';
export {
isTimeoutError,
isAbortError,
isPreparationError,
isHttpError,
isNetworkError,
Expand Down
6 changes: 6 additions & 0 deletions packages/core/src/errors/guards.ts
Expand Up @@ -27,6 +27,12 @@ export function isTimeoutError(
return args.error?.errorType === TIMEOUT;
}

/**
* Has to be private, do not export it.
*
* Since Farfetcehd 0.10 aborted RemoteOperation is not considered as an error,
* so isAbortError is not needed anymore in userland.
*/
export function isAbortError(args: WithError): args is WithError<AbortError> {
return args.error?.errorType === ABORT;
}
Expand Down

0 comments on commit 67d7288

Please sign in to comment.