docs(aio): fix "Error handling" section in "HttpClient" (#18821)
Removed additional curly brackets to fix blocks. Also replaced tab with 2 spaces. PR Close #18821
This commit is contained in:
parent
1f1caacbfd
commit
3dc4115c8b
|
@ -126,7 +126,7 @@ http
|
||||||
err => {
|
err => {
|
||||||
console.log('Something went wrong!');
|
console.log('Something went wrong!');
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Getting error details
|
#### Getting error details
|
||||||
|
@ -141,7 +141,7 @@ In both cases, you can look at the `HttpErrorResponse` to figure out what happen
|
||||||
http
|
http
|
||||||
.get<ItemsResponse>('/api/items')
|
.get<ItemsResponse>('/api/items')
|
||||||
.subscribe(
|
.subscribe(
|
||||||
data => {...},
|
data => {...},
|
||||||
(err: HttpErrorResponse) => {
|
(err: HttpErrorResponse) => {
|
||||||
if (err.error instanceof Error) {
|
if (err.error instanceof Error) {
|
||||||
// A client-side or network error occurred. Handle it accordingly.
|
// A client-side or network error occurred. Handle it accordingly.
|
||||||
|
@ -152,7 +152,7 @@ http
|
||||||
console.log(`Backend returned code ${err.status}, body was: ${err.error}`);
|
console.log(`Backend returned code ${err.status}, body was: ${err.error}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `.retry()`
|
#### `.retry()`
|
||||||
|
|
Loading…
Reference in New Issue