Comments (13)
@iDontWantAUsername well... I'm out. I'm VERY new to this. :)
from stravaphp.
Ah this is related to my issue: #65
I'm willing to spend time to make a PR but I'm not sure as to what has to happen exactly.
Would it be an idea to rethrow instead of returning $e->getMessage()
?
from stravaphp.
I also have the same issue.
from stravaphp.
@iDontWantAUsername I found that I could get the getAthlete() function working.
Change the line:
$service = new REST($token, $adapter);
to:
$service = new REST($token->getToken(), $adapter);
I'm still trying to figure out how to get the getAthleteActivities() function working now.
from stravaphp.
Thanks @bwardy , i should have been a bit clearer, if i put in a valid Token the request does work as expected.
My issue is that if i am not authorised i should get an exception from Guzzle that i can handle and return the correct message.
I am not getting the handled exceptions i used to get prior to Guzzle. I should be able to use the Exceptions rather than having to run a string comparison on the getAthlete response.
from stravaphp.
Looks like this issue is releated to #45. I fixed the problem other there, unfortunately the fix was not accepted.
from stravaphp.
The Guzzle update was quite comprehensive. Also, from 15 jan 2018 onwards there is a change in the authentication process. https://developers.strava.com/docs/oauth-updates/
So I'll try and contact @basvandorst to run over the new issues. To get these hickups ironed out.
from stravaphp.
I might be a bit late to the party here, but also experiencing similar issues to @iDontWantAUsername.
Would changing the catch block in https://github.com/basvandorst/StravaPHP/blob/master/src/Strava/API/Service/REST.php be beneficial?
StravaPHP/src/Strava/API/Service/REST.php
Lines 71 to 80 in 5b2b2a9
As opposed to returning
$e->getMessage()
, return $e->getResponse()
(or both)? Would enable you to do look at useful data such as the response code?from stravaphp.
@djjavo Yes, that would be useful. But requires a bit of a refactor of all the getResponse() calls.
Could you supply a pull request on the develop branch of my fork? https://github.com/vredeling/StravaPHP/pulls
from stravaphp.
@djjavo I'm closing this issue. If you want the $e->getMessage()
issue addressed, please open a separate issue or PR.
from stravaphp.
@notflip Yes, that would be the idea. I'll review the PR if you supply one.
I'm a bit concerned we're breaking current implementations of the this class again by making a change like this. But it makes a lot of sense to re-throw and have implementations catch the error instead of the message. Or we define a global config variable which sets the response output to text by default. You could change that param to get a throwable instead of the error text.
from stravaphp.
@vredeling I've suggested a non-breaking change (#67) for users of StravaPHP
that require extra information in the response.
from stravaphp.
@notflip since this PR #67 has been merged to the latest dev version, it is possible to check the response codes.
Just instantiate the REST client like so:
$service = new REST($token->getToken(), $adapter, 1);
That will give you access to the response headers, body and status codes.
from stravaphp.
Related Issues (20)
- Is this repo still maintained? HOT 6
- getAthleteActivities is buggy when using parameters
- getResponse doesn't throw, it already catches HOT 3
- PHPUnit tests fail when running locally HOT 2
- Laravel 8 incompatibility HOT 6
- Can you do a point release? HOT 5
- Where is autoload.php HOT 2
- Upload gpx file failed HOT 1
- Wrong scopes in README.md code examples HOT 1
- Library Compatibility HOT 11
- GitHub Link Broken HOT 3
- Scrutinizer HOT 3
- Setup Packagist for automatic updates HOT 9
- Webhook Subscriptions HOT 2
- Fix tests after type hints HOT 1
- getSegmentLeaderboard not working HOT 5
- Having trouble getting OAuth2 to work and missing refresh token HOT 7
- Get "Required option not passed: "access_token"" message, when try to exchange token second time.
- get required
- Issue with refresh page: Required option not passed: "access_token"
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 stravaphp.