Giter VIP home page Giter VIP logo

Comments (7)

kunalvarma05 avatar kunalvarma05 commented on May 31, 2024 1

@markfb Dropbox's API only returns errors (in responses). See => https://www.dropbox.com/developers/documentation/http/documentation#error-handling

Here's how to handle the exceptions thrown by the SDK:

try {
    $listFolderContents = $dropbox->listFolder($path);
} catch (DropboxClientException $e) {
    echo $e->getMessage();
}

Cheers!

from dropbox-php-sdk.

tilekus avatar tilekus commented on May 31, 2024

This issue only appears if folder is not exist in DropBox which is sending as first parameter
$dropbox->search('/not_exist_folder/', 'file_name')
request as below return fatal error

from dropbox-php-sdk.

kunalvarma05 avatar kunalvarma05 commented on May 31, 2024

@tilekus That's an expected Exception. If you try searching inside a non-existing folder, Dropbox's API will respond with an error.

More Info => https://www.dropbox.com/developers/documentation/http/documentation#SearchError

from dropbox-php-sdk.

markfb avatar markfb commented on May 31, 2024

Firstly, many thanks for pulling this great SDK together, I was starting to panic when the native Dropbox API was deprecated... I'm seeing the same exception using listFolder when the folder doesn't exist:

$listFolderContents = $dropbox->listFolder($path);

Is this also by design as it didn't throw an exception in the native V1 API? I'm struggling to find an elegant way around it....

from dropbox-php-sdk.

markfb avatar markfb commented on May 31, 2024

I've now found a way around this. Thanks!

from dropbox-php-sdk.

 avatar commented on May 31, 2024

@markfb What was your solution?

from dropbox-php-sdk.

markfb avatar markfb commented on May 31, 2024

Unfortunately it isn't particularly elegant. I'm storing a document count for each folder in my database and checking that it's 1 or more before using listFolder...

from dropbox-php-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.