OpenAPITools / OpenAPITools/openapi-generator
[REQ] Typescript-fetch returns error message
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
I have use cases where I am needed to get a more specific error code than the basics HTTP codes.
For example : I have several cases when I can get a 403. End of subscription or banned.
Describe the solution you'd like
I want to get the API's message returning to my request and not only the HTTP code and "Response returned an error code" as actualy happening.
To resolve this issue I changed the code of the request method in the 'runtime.ts' file as followed :
const message: string = !response.ok ? (await response.json()).message : 'Response returned an error code';
throw new ResponseError(response, message);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the TypeScript-fetch runtime.ts implementation and the existing ResponseError handling. Check how generated clients currently handle non-OK responses, then verify that the API-provided message is surfaced while existing HTTP-error behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100