@shopware/api-client
Advanced tools
Comparing version 0.0.0-canary-20230711133204 to 0.0.0-canary-20230712092206
{ | ||
"name": "@shopware/api-client", | ||
"version": "0.0.0-canary-20230711133204", | ||
"version": "0.0.0-canary-20230712092206", | ||
"description": "Shopware client for API connection.", | ||
@@ -34,4 +34,4 @@ "author": "Shopware", | ||
"vitest": "^0.33.0", | ||
"@shopware/api-gen": "0.0.0-canary-20230711133204", | ||
"eslint-config-shopware": "0.0.0-canary-20230711133204", | ||
"@shopware/api-gen": "0.0.0-canary-20230712092206", | ||
"eslint-config-shopware": "0.0.0-canary-20230712092206", | ||
"tsconfig": "0.0.0" | ||
@@ -38,0 +38,0 @@ }, |
@@ -118,2 +118,21 @@ # shopware/frontends - api-client | ||
### Error handling | ||
Client is throwing `ApiClientError` with detailed information returned from the API. It will display clear message in the console or you can access `details` property to get raw information from the response. | ||
```typescript | ||
import { ApiClientError } from "@shopware/api-client"; | ||
try { | ||
// ... your request | ||
} catch (error) { | ||
if (error instanceof ApiClientError) { | ||
console.error(error); // This prints message summary | ||
console.error("Details:", error.details); // Raw response from API | ||
} else { | ||
console.error("==>", error); // Another type of error, not recognized by API client | ||
} | ||
} | ||
``` | ||
## Links | ||
@@ -131,6 +150,27 @@ | ||
### Latest changes: 0.0.0-canary-20230711133204 | ||
### Latest changes: 0.0.0-canary-20230712092206 | ||
### Minor Changes | ||
- [#316](https://github.com/shopware/frontends/pull/316) [`589c09c`](https://github.com/shopware/frontends/commit/589c09cdd9dee0db172c371afc5ecd740bdb4723) Thanks [@patzick](https://github.com/patzick)! - Improved error handling. Api client now throws `ApiClientError` with detailed information about what went wrong with request. | ||
example: | ||
```typescript | ||
import { ApiClientError } from "@shopware/api-client"; | ||
try { | ||
// ... your request | ||
} catch (error) { | ||
if (error instanceof ApiClientError) { | ||
console.error(error); // This prints message summary | ||
console.error("Details:", error.details); // Raw response from API | ||
} else { | ||
console.error("==>", error); // Another type of error, not recognized by API client | ||
} | ||
} | ||
``` | ||
### Patch Changes | ||
- [#303](https://github.com/shopware/frontends/pull/303) [`aeb639a`](https://github.com/shopware/frontends/commit/aeb639a3244f812c275145345618e5bc0045be0d) Thanks [@patzick](https://github.com/patzick)! - Improved linting in packages. Types should be more reliable |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
3857600
115598
175