Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to handle exception using Freshdesk API. #14

Open
rameshwebmaster opened this issue Nov 30, 2017 · 1 comment
Open

how to handle exception using Freshdesk API. #14

rameshwebmaster opened this issue Nov 30, 2017 · 1 comment

Comments

@rameshwebmaster
Copy link

rameshwebmaster commented Nov 30, 2017

try{
$tickets = Freshdesk::tickets()->all(['tag'=>'Lead']);
dd($tickets);
}catch(\Exception $e) {
echo $response = $e->getResponse();

    }

its not showing error response ?
I am using Lumen and installed freshdesk sdk via composer

@TheFrankman
Copy link

I had a similar issues and had to fork and modify the PHP SDK myself.

Api.php peformRequestMethod add this in the catch :

$actualError = $e->getResponse()->getBody()->getContents();

Then pass that to the ApiException

throw ApiException::create($e, $actualError);

Then modify the ApiException class to pass that error along in the __construct method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants