Skip to content

Commit 705d32f

Browse files
authored
Merge pull request #2398 from the-guild-org/changeset-release/master
Upcoming Release Changes
2 parents bc0cf13 + cbc3286 commit 705d32f

File tree

4 files changed

+68
-54
lines changed

4 files changed

+68
-54
lines changed

.changeset/floppy-states-throw.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/http-error-server-error.md

Lines changed: 0 additions & 48 deletions
This file was deleted.

packages/apollo-angular/CHANGELOG.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,72 @@
11
# Change log
22

3+
## 14.0.0
4+
5+
### Major Changes
6+
7+
- [#2395](https://github.com/the-guild-org/apollo-angular/pull/2395)
8+
[`4e9f107`](https://github.com/the-guild-org/apollo-angular/commit/4e9f107aa556c10cbe6c552e876cc9e96aac0618)
9+
Thanks [@JesseZomer](https://github.com/JesseZomer)! - **BREAKING CHANGE**: HTTP errors now return
10+
Apollo Client's `ServerError` instead of Angular's `HttpErrorResponse`
11+
12+
When Apollo Server returns non-2xx HTTP status codes (status >= 300), apollo-angular's HTTP links
13+
now return `ServerError` from `@apollo/client/errors` instead of Angular's `HttpErrorResponse`.
14+
This enables proper error detection in errorLinks using `ServerError.is(error)` and provides
15+
consistent error handling with Apollo Client's ecosystem.
16+
17+
**Migration Guide:**
18+
19+
Before:
20+
21+
```typescript
22+
import { HttpErrorResponse } from '@angular/common/http';
23+
24+
link.request(operation).subscribe({
25+
error: err => {
26+
if (err instanceof HttpErrorResponse) {
27+
console.log(err.status);
28+
console.log(err.error);
29+
}
30+
},
31+
});
32+
```
33+
34+
After:
35+
36+
```typescript
37+
import { ServerError } from '@apollo/client/errors';
38+
39+
link.request(operation).subscribe({
40+
error: err => {
41+
if (ServerError.is(err)) {
42+
console.log(err.statusCode);
43+
console.log(err.bodyText);
44+
console.log(err.response.headers);
45+
}
46+
},
47+
});
48+
```
49+
50+
**Properties Changed:**
51+
- `err.status``err.statusCode`
52+
- `err.error``err.bodyText` (always string, JSON stringified for objects)
53+
- `err.headers` (Angular HttpHeaders) → `err.response.headers` (native Headers)
54+
- Access response via `err.response` which includes: `status`, `statusText`, `ok`, `url`, `type`,
55+
`redirected`
56+
57+
**Note:** This only affects HTTP-level errors (status >= 300). Network errors and other error
58+
types remain unchanged. GraphQL errors in the response body are still processed normally through
59+
Apollo Client's error handling.
60+
61+
Fixes #2394
62+
63+
### Patch Changes
64+
65+
- [#2392](https://github.com/the-guild-org/apollo-angular/pull/2392)
66+
[`8d2be64`](https://github.com/the-guild-org/apollo-angular/commit/8d2be646a73e74654f5e0ff1c3fdf71a64d1648a)
67+
Thanks [@vz-tl](https://github.com/vz-tl)! - Allow headers type in DefaultContext to be Record or
68+
HttpHeaders
69+
370
## 13.0.0
471

572
### Major Changes

packages/apollo-angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "apollo-angular",
3-
"version": "13.0.0",
3+
"version": "14.0.0",
44
"type": "module",
55
"description": "Use your GraphQL data in your Angular app, with the Apollo Client",
66
"repository": {

0 commit comments

Comments
 (0)