File tree Expand file tree Collapse file tree
modules/openapi-generator/src/main/resources/php Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -482,17 +482,20 @@ use {{invokerPackage}}\ObjectSerializer;
482482 { {/returnType} }
483483 },
484484 function ($exception) {
485- $response = $exception -> getResponse ();
486- $statusCode = $response -> getStatusCode ();
485+ if ($exception instanceof RequestException) {
486+ throw new ApiException(
487+ " [{$exception->getCode()}] {$exception->getMessage()}" ,
488+ (int) $exception -> getCode (),
489+ $exception -> getResponse () ? $exception -> getResponse ()-> getHeaders () : null,
490+ $exception -> getResponse () ? (string) $exception -> getResponse ()-> getBody () : null
491+ );
492+ }
493+
487494 throw new ApiException(
488- sprintf(
489- ' [%d] Error connecting to the API (%s)' ,
490- $statusCode ,
491- $exception -> getRequest ()-> getUri ()
492- ),
493- $statusCode ,
494- $response -> getHeaders (),
495- (string) $response -> getBody ()
495+ "[{ $exception -> getCode ()} ] { $exception -> getMessage ()} ",
496+ (int) $exception->getCode(),
497+ null,
498+ null
496499 );
497500 }
498501 );
You can’t perform that action at this time.
0 commit comments