Throw error on error and data property be defined #1687
Labels
enhancement
New feature or request
openapi-fetch
Relevant to the openapi-fetch library
PRs welcome
PRs are welcome to solve this issue!
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
The text was updated successfully, but these errors were encountered: