Comments (6)
This issue is about to receive a good update in v5.1.0 🎉
from google-translate-php.
Leaving ErrorException
after two years of thinking 😆 For the same reasons stated above.
from google-translate-php.
Great job, props to you for still maintaining this repo and taking care of the feedbacks!
from google-translate-php.
Ok, I got the point. The reason was to be more independent from http client package. I mean if someday we will switch from Guzzle to something else, it would be smooth operation without major changes and developers will not have to change their code to handle SomeNewHttpClientExceptions
instead of GuzzleRequestException
.
from google-translate-php.
Thanks for the explanation, I understand now.
Here are the exceptions of Guzzle and how they extends other classes:
\Exception
\ErrorException (this library)
\RuntimeException
SeekException
TransferException
RequestException
ConnectException
TooManyRedirectsException
BadResponseException
ClientException
ServerException
In my situation it is important to check, if the exception is a ConnectException
or any BadResponseException
, because I'm using proxies to get around Google IP bans (as I even get banned with this library after a few hours - maybe due to large number of requests). If a proxy is temporary down for some reason (which happens many times), I get a ConnectException
, but if Google banned any of them (and I shouldn't use it for like 24 hours), it will raise a ClientException
(4xx type errors, like 403 Forbidden) or ServerException
(5xx type errors, like 503 Service Unavailable).
• I think it would be wrong to switch to Guzzle's exceptions, because
the parent class of Guzzle's exceptions is \RuntimeException
, and this library throws \ErrorException
, so if someone only catches the second one, an update could break his site/app.
• I think it would be good to switch to Guzzle's exceptions, because
As long as someone catches \Exception
, the using of Guzzle's custom exceptions shouldn't cause any problem. And I think catching custom exceptions, but not catching \Exception
is a bad programming practice, so hopefully nobody using this library made this mistake.
Of course it's on you to switch or not, I can use my synchronized private fork anytime, just wanted to share my thoughts and ideas :)
from google-translate-php.
Sure, thanks for sharing your opinion, appreciated that.
I'll think about this again, because currently both options seem to be correct. Can't decide easily.
from google-translate-php.
Related Issues (20)
- setUrl() It is not available in mainland China HOT 1
- Memory Usage HOT 4
- Very slow HOT 1
- Country an cities sometimes are not translated HOT 4
- ErrorException: Maximum execution time of 60 seconds exceeded HOT 4
- Class "Stichoza\GoogleTranslate\GoogleTranslate" not found HOT 1
- How do I swap to using my own paid api key? HOT 1
- Loading Problem. HOT 2
- I use the IP of a VPN server as a proxy, I wonder why it doesn't work when I use 'https' instead? HOT 5
- Can you give me a list of free Proxies that I can use so that translation is not blocked in the future? HOT 1
- Can you fix this bug in your library for me?
- 400 Bad Request Client error: GET HOT 5
- Can you add the link of my package to your package? HOT 1
- Ignore escaped keys on translations HOT 4
- Error: Class "Stichoza\GoogleTranslate\GoogleTranslate" not found in file HOT 6
- Bug report: preserveParameters gives unexpected results when translating to French HOT 1
- cURL error 60: SSL certificate problem HOT 1
- Please assist me HOT 3
- How can I translate my page web HTML into your library? HOT 2
- PHP - extract the children from this <div id="page-container"> then translate it and put them back into this same <div id="page-container">
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google-translate-php.