Skip to content
This repository has been archived by the owner on Feb 12, 2019. It is now read-only.

How to catch error or show status #3

Closed
vulieumang opened this issue Jun 18, 2016 · 3 comments
Closed

How to catch error or show status #3

vulieumang opened this issue Jun 18, 2016 · 3 comments

Comments

@vulieumang
Copy link

vulieumang commented Jun 18, 2016

in this document
https://www.dropbox.com/developers/documentation/http/documentation#files-save_url-check_job_status
by using curl we can have see error in command

curl -X POST https://api.dropboxapi.com/2/files/save_url \
    --header "Authorization: Bearer EXDuL6Bkvc4AAAAAAAABu-ZDfXZ0FRw87e00zjkrDbK2Rw_UpEGqlA-hz_tDgS3W" \
    --header "Content-Type: application/json" \
    --data "{\"path\": \"/a.jpg\",\"url\": \"https://igcdn-photos-e-a.akamaihd.net/hphotos-ak-xat1/t51.2885-15/e15/13398575_977722398990188_1841788166_n.jpg
\"}"

image
and now we see error in command
Error in call to API function "files/save_url": request body: could not decode input as JSON
and how to see in browser
I was set ini_set('display_errors', 1);

@Alorel
Copy link
Owner

Alorel commented Jun 18, 2016

I am here to provide support with the library, not curl.
On 18 Jun 2016 10:44 am, "Vu" notifications@github.com wrote:

in this document

https://www.dropbox.com/developers/documentation/http/documentation#files-save_url-check_job_status
by using curl we can have see error in command

curl -X POST https://api.dropboxapi.com/2/files/save_url
--header "Authorization: Bearer EXDuL6Bkvc4AAAAAAAABu-ZDfXZ0FRw87e00zjkrDbK2Rw_UpEGqlA-hz_tDgS3W"
--header "Content-Type: application/json"
--data "{"path": "/a.jpg","url": "https://igcdn-photos-e-a.akamaihd.net/hphotos-ak-xat1/t51.2885-15/e15/13398575_977722398990188_1841788166_n.jpg
"}"

[image: image]
https://cloud.githubusercontent.com/assets/13487753/16170150/2085052e-3573-11e6-96e2-378bd97870a4.png
and how we see error in command
Error in call to API function "files/save_url": request body: could not
decode input as JSON

and how to see in browser
I was set ini_set('display_errors', 1);


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#3, or mute the thread
https://github.com/notifications/unsubscribe/AExDlshEmLD8UR8upevsLOYEb12j45o7ks5qM73_gaJpZM4I46YJ
.

@Alorel Alorel closed this as completed Jun 18, 2016
@vulieumang
Copy link
Author

vulieumang commented Jun 18, 2016

I mean is how to show error in this library, i can't see error when use lib and i don't know why it happen.
Then i use curl to check, i see error, i think this lib have way to show error.
With this code i only see
`Not saved yet - waiting for 3 seconds before checking for the job status

if (isset($resp['async_job_id'])) {
            $check = new CheckJobStatus();

            do {
                echo 'Not saved yet - waiting for 3 seconds before checking for the job status' . PHP_EOL;
                sleep(3); //Wait a bit
                $r = json_decode($check->raw($resp['async_job_id'])->getBody()->getContents(), true);
            } while (isset($r['.tag']) && $r['.tag'] == 'in_progress');

            echo 'URL saved';
            } else {
            echo 'URL saved';

        }

that is my mean, i not good about type but i has find in example in this lib to show error, and i have stuck.

@Alorel
Copy link
Owner

Alorel commented Jun 18, 2016

Read the Dropbox API docs about why this is needed. If there was an actual error an exception would be thrown.

Repository owner locked and limited conversation to collaborators Jun 18, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants