File tree Expand file tree Collapse file tree
modules/openapi-generator/src/main/resources/Javascript/es6
samples/client/petstore/javascript-promise-es6/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -372,7 +372,7 @@ class ApiClient {
372372 * @param { Array.< String> } accepts An array of acceptable response MIME types.
373373 * @param { (String|Array|ObjectFunction)} returnType The required type to return; can be a string for simple types or the
374374 * constructor for a complex type.
375- * @param { String} apiBasePath base path defined in the operation/path level to override the default one
375+ * @param { String} apiBasePath base path defined in the operation/path level to override the default one
376376 { {^usePromises} }
377377 * @param { module:{{#invokerPackage} }{ {invokerPackage} }/{ {/invokerPackage} }ApiClient~callApiCallback} callback The callback function.
378378 { {/usePromises} }
@@ -469,10 +469,12 @@ class ApiClient {
469469 request.end((error, response) => {
470470 if (error) {
471471 var err = {} ;
472- err.status = response.status;
473- err.statusText = response.statusText;
474- err.body = response.body;
475- err.response = response;
472+ if (response) {
473+ err.status = response.status;
474+ err.statusText = response.statusText;
475+ err.body = response.body;
476+ err.response = response;
477+ }
476478 err.error = error;
477479
478480 reject(err);
Original file line number Diff line number Diff line change @@ -355,7 +355,7 @@ class ApiClient {
355355 * @param {Array.<String> } accepts An array of acceptable response MIME types.
356356 * @param {(String|Array|ObjectFunction) } returnType The required type to return; can be a string for simple types or the
357357 * constructor for a complex type.
358- * @param {String } apiBasePath base path defined in the operation/path level to override the default one
358+ * @param {String } apiBasePath base path defined in the operation/path level to override the default one
359359 * @returns {Promise } A {@link https://www.promisejs.org/|Promise} object.
360360 */
361361 callApi ( path , httpMethod , pathParams ,
@@ -447,10 +447,12 @@ class ApiClient {
447447 request . end ( ( error , response ) => {
448448 if ( error ) {
449449 var err = { } ;
450- err . status = response . status ;
451- err . statusText = response . statusText ;
452- err . body = response . body ;
453- err . response = response ;
450+ if ( response ) {
451+ err . status = response . status ;
452+ err . statusText = response . statusText ;
453+ err . body = response . body ;
454+ err . response = response ;
455+ }
454456 err . error = error ;
455457
456458 reject ( err ) ;
You can’t perform that action at this time.
0 commit comments