mirror of
https://github.com/moodle/moodle.git
synced 2025-08-02 15:49:43 +02:00
MDL-57666 repositories: Error when copying file from Dropbox repository
This commit is contained in:
parent
6e8235c7d3
commit
b4d5080892
2 changed files with 4 additions and 4 deletions
|
@ -177,7 +177,7 @@ class dropbox extends \oauth2_client {
|
||||||
* This function attempts to deal with errors as per
|
* This function attempts to deal with errors as per
|
||||||
* https://www.dropbox.com/developers/documentation/http/documentation#error-handling.
|
* https://www.dropbox.com/developers/documentation/http/documentation#error-handling.
|
||||||
*
|
*
|
||||||
* @param string $data The returned content.
|
* @param mixed $data The returned content.
|
||||||
* @throws moodle_exception
|
* @throws moodle_exception
|
||||||
*/
|
*/
|
||||||
protected function check_and_handle_api_errors($data) {
|
protected function check_and_handle_api_errors($data) {
|
||||||
|
@ -197,8 +197,8 @@ class dropbox extends \oauth2_client {
|
||||||
throw new authentication_exception('Authentication token expired');
|
throw new authentication_exception('Authentication token expired');
|
||||||
break;
|
break;
|
||||||
case 409:
|
case 409:
|
||||||
// Endpoint-specific error. Look to the response body for the specifics of the error.
|
// Endpoint-specific error. Look to the JSON response body for the specifics of the error.
|
||||||
throw new \coding_exception('Endpoint specific error: ' . $data);
|
throw new \coding_exception('Endpoint specific error: ' . $data->error_summary);
|
||||||
break;
|
break;
|
||||||
case 429:
|
case 429:
|
||||||
// Your app is making too many requests for the given user or team and is being rate limited. Your app
|
// Your app is making too many requests for the given user or team and is being rate limited. Your app
|
||||||
|
|
|
@ -116,7 +116,7 @@ class repository_dropbox_api_testcase extends advanced_testcase {
|
||||||
],
|
],
|
||||||
'409 http_code' => [
|
'409 http_code' => [
|
||||||
['http_code' => 409],
|
['http_code' => 409],
|
||||||
'Some data here',
|
json_decode('{"error": "Some value", "error_summary": "Some data here"}'),
|
||||||
'coding_exception',
|
'coding_exception',
|
||||||
'Endpoint specific error: Some data here',
|
'Endpoint specific error: Some data here',
|
||||||
],
|
],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue