typescript-node: Reject Promises in using Error instances instead of plain objects
Created by: ghost
Is your feature request related to a problem? Please describe.
In generated typescript code promises are rejected with plain objects instead of error instances. By not using errors we loose stacktraces and thus easy debugging.
Describe the solution you'd like
Reject Promises with proper Error instances. This would be done here: https://github.com/OpenAPITools/openapi-generator/blob/e73bf9be1d79746b31046424f3ab011b0584ac95/modules/openapi-generator/src/main/resources/typescript-node/api-single.mustache#L225
I can provide a PR, if you are going to accept it. This would be a breaking change.
I would add a new HttpError
class with a statusCode
property. Additionally We can add body
and response
. This would be a breaking change, but in my opinion a good one.
Describe alternatives you've considered
I don't think there is any viable alternative
Additional context
I come from kubernetes-client/javascript#336