openapi-typescript icon indicating copy to clipboard operation
openapi-typescript copied to clipboard

Throw error on error and data property be defined

Open Noahkoole opened this issue 1 year ago • 3 comments

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

Noahkoole avatar Jun 01 '24 10:06 Noahkoole