swagger-api / swagger-api/swagger-codegen
[PHP] Guzzle has no ConnectException Handling
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I created a PHP Client using swagger-codegen. I'm calling the async method.
When the endpoint is not available, a
ConnectException
is thrown.
But the exception handling doesn't check for the exception and tries anyway to get the http status code by calling
$response = $exception->getStatusCode();
which of course fails fatally.
Is there a workaround here?
Swagger-codegen version
Swagger Codegen version: 2.4.5
Swagger declaration file content or url
Used the online swagger editor.
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
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 with the generated PHP client's async method and trace the exception path when the endpoint is unavailable. Check how ConnectException differs from exceptions with an HTTP status, then reproduce the failure using the online Swagger Editor workflow; done means connection failures no longer cause a fatal status-code lookup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100