original_string: public static function handleError(BadResponseException $exception)
      {
          $response_body = (string) $exception->getResponse()->getBody();
          $array_body = decode($response_body);
  
          $code = $exception->getResponse()->getStatusCode();
  
          $lookForKeys = ['message', 'code', 'error'];
  
          foreach ($lookForKeys as $key) {
              if (isset($array_body[$key])) {
                  $message = $array_body[$key];
              }
          }
  
          if (!$message) {
              $message = 'unknown_error';
          }
  
          throw new JSONError($message, $code, $array_body);
      }
code: public static function handleError(BadResponseException $exception)
      {
          $response_body = (string) $exception->getResponse()->getBody();
          $array_body = decode($response_body);
  
          $code = $exception->getResponse()->getStatusCode();
  
          $lookForKeys = ['message', 'code', 'error'];
  
          foreach ($lookForKeys as $key) {
              if (isset($array_body[$key])) {
                  $message = $array_body[$key];
              }
          }
  
          if (!$message) {
              $message = 'unknown_error';
          }
  
          throw new JSONError($message, $code, $array_body);
      }
code_tokens: public static function handleError ( BadResponseException $ exception ) { $ response_body = ( string ) $ exception -> getResponse ( ) -> getBody ( ) ; $ array_body = decode ( $ response_body ) ; $ code = $ exception -> getResponse ( ) -> getStatusCode ( ) ; $ lookForKeys = [ 'message' , 'code' , 'error' ] ; foreach ( $ lookForKeys as $ key ) { if ( isset ( $ array_body [ $ key ] ) ) { $ message = $ array_body [ $ key ] ; } } if ( ! $ message ) { $ message = 'unknown_error' ; } throw new JSONError ( $ message , $ code , $ array_body ) ; }
docstring: Handles the error for us, just a bit of code abstraction.
  
  @param BadResponseException $exception
  
  @throws JSONError
docstring_tokens: Handles the error for us just a bit of code abstraction .