dropbox-php-sdk
dropbox-php-sdk copied to clipboard
Catching dropbox api error
Is there a way to catch the errors thrown by the dropbox api? Currently if a folder or file is not found, the api returns an error message, but Guzzle returns a fatal error...is there a way to capture that instead of throwing a fatal error?
Thank you so much for your help!
I came across the same issue. I fixed it by catching the exception this way:
<?php
try {
$folder = $dropbox->getMetadata("/Category");
} catch (\Exception $e) {
}
?>
Thank you so much for your reply.
Now, a really dumb question:
I use the following to connect:
$app = new DropboxApp( "all params required" ); $dropbox = new Dropbox($app);
I noticed you use the method connectToDropbox(), which I can’t seem to find in the documentation…can you please tell me what is the difference and if I should connect that way instead?
Many thanks in advance for all your help!
On 20 Apr 2018, at 08:19, Codefuel [email protected] wrote:
I came across the same issue. I fixed it by catching the exception this way:
connectToDropbox(); try { $folder = $dropbox->getMetadata("/Category"); } catch (\Exception $e) { } ?>— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kunalvarma05/dropbox-php-sdk/issues/125#issuecomment-382991419, or mute the thread https://github.com/notifications/unsubscribe-auth/AksDIzmg9ZjiHq9iYrgWfdStxLrRW8U6ks5tqX4HgaJpZM4TZ9qW.
That is a function I have created to wrap the connection in. It's not needed.