original_string: protected function check_and_handle_api_errors($data) {
          if ($this->info['http_code'] == 200) {
              // Dropbox only returns errors on non-200 response codes.
              return;
          }
  
          switch($this->info['http_code']) {
              case 400:
                  // Bad input parameter. Error message should indicate which one and why.
                  throw new \coding_exception('Invalid input parameter passed to DropBox API.');
                  break;
              case 401:
                  // Bad or expired token. This can happen if the access token is expired or if the access token has been
                  // revoked by Dropbox or the user. To fix this, you should re-authenticate the user.
                  throw new authentication_exception('Authentication token expired');
                  break;
              case 409:
                  // Endpoint-specific error. Look to the JSON response body for the specifics of the error.
                  throw new \coding_exception('Endpoint specific error: ' . $data->error_summary);
                  break;
              case 429:
                  // Your app is making too many requests for the given user or team and is being rate limited. Your app
                  // should wait for the number of seconds specified in the "Retry-After" response header before trying
                  // again.
                  throw new rate_limit_exception();
                  break;
              default:
                  break;
          }
  
          if ($this->info['http_code'] >= 500 && $this->info['http_code'] < 600) {
              throw new \invalid_response_exception($this->info['http_code'] . ": " . $data);
          }
      }
code: protected function check_and_handle_api_errors($data) {
          if ($this->info['http_code'] == 200) {
              // Dropbox only returns errors on non-200 response codes.
              return;
          }
  
          switch($this->info['http_code']) {
              case 400:
                  // Bad input parameter. Error message should indicate which one and why.
                  throw new \coding_exception('Invalid input parameter passed to DropBox API.');
                  break;
              case 401:
                  // Bad or expired token. This can happen if the access token is expired or if the access token has been
                  // revoked by Dropbox or the user. To fix this, you should re-authenticate the user.
                  throw new authentication_exception('Authentication token expired');
                  break;
              case 409:
                  // Endpoint-specific error. Look to the JSON response body for the specifics of the error.
                  throw new \coding_exception('Endpoint specific error: ' . $data->error_summary);
                  break;
              case 429:
                  // Your app is making too many requests for the given user or team and is being rate limited. Your app
                  // should wait for the number of seconds specified in the "Retry-After" response header before trying
                  // again.
                  throw new rate_limit_exception();
                  break;
              default:
                  break;
          }
  
          if ($this->info['http_code'] >= 500 && $this->info['http_code'] < 600) {
              throw new \invalid_response_exception($this->info['http_code'] . ": " . $data);
          }
      }
code_tokens: protected function check_and_handle_api_errors ( $ data ) { if ( $ this -> info [ 'http_code' ] == 200 ) { // Dropbox only returns errors on non-200 response codes. return ; } switch ( $ this -> info [ 'http_code' ] ) { case 400 : // Bad input parameter. Error message should indicate which one and why. throw new \ coding_exception ( 'Invalid input parameter passed to DropBox API.' ) ; break ; case 401 : // Bad or expired token. This can happen if the access token is expired or if the access token has been // revoked by Dropbox or the user. To fix this, you should re-authenticate the user. throw new authentication_exception ( 'Authentication token expired' ) ; break ; case 409 : // Endpoint-specific error. Look to the JSON response body for the specifics of the error. throw new \ coding_exception ( 'Endpoint specific error: ' . $ data -> error_summary ) ; break ; case 429 : // Your app is making too many requests for the given user or team and is being rate limited. Your app // should wait for the number of seconds specified in the "Retry-After" response header before trying // again. throw new rate_limit_exception ( ) ; break ; default : break ; } if ( $ this -> info [ 'http_code' ] >= 500 && $ this -> info [ 'http_code' ] < 600 ) { throw new \ invalid_response_exception ( $ this -> info [ 'http_code' ] . ": " . $ data ) ; } }
docstring: Check for an attempt to handle API errors.
  
  This function attempts to deal with errors as per
  https://www.dropbox.com/developers/documentation/http/documentation#error-handling.
  
  @param   mixed      $data       The returned content.
  @throws  moodle_exception
docstring_tokens: Check for an attempt to handle API errors .