[BUG][JavaScript]Timeout unhandled causes crash after PR #1814
Created by: fabik111
Description
With PR #1814 was added in the callApi function an object err to better handle errors. err has four attributes taken from the response obj>
request.end((error, response) => {
if (error) {
var err = {};
err.status = response.status;
err.statusText = response.statusText;
err.body = response.body;
err.response = response;
err.error = error;
reject(err);
If the call ends with a timeout error, the response obj will be undefined and so I've this problem:
TypeError: Cannot read property 'status' of undefined
openapi-generator version
v4.1.3
Related issues/PRs
Suggest a fix/enhancement
Add a check if response is undefined