Giter VIP home page Giter VIP logo

Comments (3)

SneakyDave avatar SneakyDave commented on June 1, 2024

I probably just need a way to get the $rawResponse I think.

I'm using this code to upload a file
'''
$result = $dropbox->upload($dropboxFile,$dropboxDir.$uploadname);
'''
And the error is thrown in the send method (obviously). But would the $rawReponse be available in the $result if the send() method fails?

from dropbox-php-sdk.

kunalvarma05 avatar kunalvarma05 commented on June 1, 2024

@SneakyDave I tried reproducing the bug, but the exception being thrown contains an error message at all times. However, the error message depends on the type of the error (https://www.dropbox.com/developers/documentation/http/documentation#error-handling). Therefore, I might need more information to reproduce the bug.

What error/exception message and response code are you being shown when calling the upload() method fails? Can you try and reproduce this bug with the following code:

$file = __DIR__ . "/hello.txt"; // Replace this with a path to an existing file
try {
   // Upload the file with an invalid mode. Valid modes are: add, overwrite and update
    var_dump($dropbox->upload($file, "/hello.txt", ['mode' => 'invalid-mode']));
} catch (Exception $e) {
    echo $e->getMessage();
}

This should show the following error message:
Error in call to API function "files/upload": HTTP header "Dropbox-API-Arg": mode: unknown tag 'invalid-mode'

Thanks.

from dropbox-php-sdk.

SneakyDave avatar SneakyDave commented on June 1, 2024

It isn't a consistent error. It's part of an addon I wrote for XenForo that uploads a backup file of a XenForo installation to DropBox, and users of the addon have reported that once in a while, using the addon will return an error from the GuzzleHttpClient on the upload method:
https://xenforo.com/community/threads/solidmean-forumbackup-dropbox-upload-paid.102856/page-4#post-1093298

I was just curious if there was a way to better trap the error message, because right now, it just throws the exception.

But let me look at my code, maybe I don't have a try/catch, and not getting the exception message.

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.