Comments (12)
@coderholic @scofield-ua I'll take a look later today and will fix/close this issue.
from php.
@jhtimmins
A function definition must include all uncatched exceptions. The exceptions may rise inside the function code or inside other functions that your original function calls. The functions that you call use Guzzle, and Guzzle functions throw \GuzzleHttp\Exception\GuzzleException
. You don't catch exceptions from Guzzle therefore you pass them to the user. As a result you have to specify the \GuzzleHttp\Exception\GuzzleException
in the PHPDoc.
from php.
This was fixed in commit 6068f65.
I've added an IPinfoException
class which will get returned instead of the base Exception
class or the GuzzleException
class.
from php.
Add in PHPDoc that the function may rise an Exception
from php.
from php.
from php.
@scofield-ua my apologies, I ran into some issues with my computer so I'm having trouble testing this, which may delay me a bit.
In the meantime, could you clarify why it's necessary to import Exceptions from multiple locations?
from php.
@jhtimmins no problem, thanks.
I think the main idea of this issue is to fix the part where you're throwing global Exception
class. For example here:
Lines 98 to 100 in 5b360e3
Right now global Exception class is throwing in local namespace: ipinfo\ipinfo
, which is causing fatal error.
Need to use throw new \Exception
instead of throw new Exception
, or just connect it at the beginning of the class.
In my project I'm currently have to catch Throwable
exception.
Also, I think, instead of general global Exception
class would be good to throw some custom named exception which is related only for IpInfo package, something like IpInfoException
which you can use to throw any kind (or specific kind) of errors.
from php.
@jhtimmins, the comment of @scofield-ua is absolutely correct. That's what have been done in my PR #5
Additionally I added the correct information about the exceptions in PHPDoc.
from php.
@scofield-ua Ah of course, yes that makes sense. I actually thought you submitted the PR with multiple exception types, which should have been directed at the PR author. Thanks for the info.
@rvalitov Could you explain this docblock, and why it includes two exception types?
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Exception
It doesn't look like \GuzzleHttp\Exception\GuzzleException
will ever get thrown directly. Or am I missing something?
from php.
😊
from php.
If 6068f65 does not resolve this issue, please let me know and we can reopen.
from php.
Related Issues (20)
- Please update Composer package HOT 7
- r -v
- PHP 8 Support HOT 2
- Features of extracting json Not working HOT 5
- Make caching more easily optional HOT 4
- Support for IP summarization
- Request: New Map feature to be added HOT 5
- Use versioned cache key
- Add documentation for batch ops function
- Token Referrer restriction with PHP Lib HOT 2
- Step by step install not working HOT 4
- Implement Stringable interface
- More info on why response object can be null when calling IPinfo::getDetails() HOT 12
- Hopper
- Retrieving your public IPv6 address
- The php api does not work on the server but it does on the localhost HOT 1
- Make it possible to use sabre/cache version 2 HOT 4
- Just a detail (php8.2): Creation of dynamic property ipinfo\ipinfo\IPinfo::$settings is deprecated HOT 1
- Error with cache key HOT 1
- Inline all data files HOT 1
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 php.