openapi-typescript
openapi-typescript copied to clipboard
Throw error on error and data property be defined
Description
Currently when a request fails it fills the error property and leaves the data property undefined. It would be a very nice feature if you could throw an error on error which in turn then makes the data property always defined. This implementation matches Axios. Currently I want to transition to openapi-fetch from axios but this change breaks a lot of code as I rely on try catch statements
Proposal
A option in the config of createClient where you can toggle if you want to throw an error rather then return the error value.
Checklist
- [ ] I’m willing to open a PR for this (see CONTRIBUTING.md)