private static function imagesApplicationErrorToException($error) {
    switch($error->getApplicationError()) {
      case ImagesServiceError\ErrorCode::UNSPECIFIED_ERROR:
        $result = new CloudStorageException('Unspecified error with image.');
        break;
      case ImagesServiceError\ErrorCode::BAD_TRANSFORM_DATA:
        $result = new CloudStorageException('Bad image transform data.');
        break;
      case ImagesServiceError\ErrorCode::NOT_IMAGE:
        $result = new CloudStorageException('Not an image.');
        break;
      case ImagesServiceError\ErrorCode::BAD_IMAGE_DATA:
        $result = new CloudStorageException('Bad image data.');
        break;
      case ImagesServiceError\ErrorCode::IMAGE_TOO_LARGE:
        $result = new CloudStorageException('Image too large.');
        break;
      case ImagesServiceError\ErrorCode::INVALID_BLOB_KEY:
        $result = new CloudStorageException('Invalid blob key for image.');
        break;
      case ImagesServiceError\ErrorCode::ACCESS_DENIED:
        $result = new CloudStorageException('Access denied to image.');
        break;
      case ImagesServiceError\ErrorCode::OBJECT_NOT_FOUND:
        $result = new CloudStorageException('Image object not found.');
        break;
      default:
        $result = new CloudStorageException(
            'Images Error Code: ' . $error->getApplicationError());
    }
    return $result;
  }
private static function imagesApplicationErrorToException($error) {
    switch($error->getApplicationError()) {
      case ImagesServiceError\ErrorCode::UNSPECIFIED_ERROR:
        $result = new CloudStorageException('Unspecified error with image.');
        break;
      case ImagesServiceError\ErrorCode::BAD_TRANSFORM_DATA:
        $result = new CloudStorageException('Bad image transform data.');
        break;
      case ImagesServiceError\ErrorCode::NOT_IMAGE:
        $result = new CloudStorageException('Not an image.');
        break;
      case ImagesServiceError\ErrorCode::BAD_IMAGE_DATA:
        $result = new CloudStorageException('Bad image data.');
        break;
      case ImagesServiceError\ErrorCode::IMAGE_TOO_LARGE:
        $result = new CloudStorageException('Image too large.');
        break;
      case ImagesServiceError\ErrorCode::INVALID_BLOB_KEY:
        $result = new CloudStorageException('Invalid blob key for image.');
        break;
      case ImagesServiceError\ErrorCode::ACCESS_DENIED:
        $result = new CloudStorageException('Access denied to image.');
        break;
      case ImagesServiceError\ErrorCode::OBJECT_NOT_FOUND:
        $result = new CloudStorageException('Image object not found.');
        break;
      default:
        $result = new CloudStorageException(
            'Images Error Code: ' . $error->getApplicationError());
    }
    return $result;
  }
private static function imagesApplicationErrorToException ( $ error ) { switch ( $ error -> getApplicationError ( ) ) { case ImagesServiceError \ ErrorCode :: UNSPECIFIED_ERROR : $ result = new CloudStorageException ( 'Unspecified error with image.' ) ; break ; case ImagesServiceError \ ErrorCode :: BAD_TRANSFORM_DATA : $ result = new CloudStorageException ( 'Bad image transform data.' ) ; break ; case ImagesServiceError \ ErrorCode :: NOT_IMAGE : $ result = new CloudStorageException ( 'Not an image.' ) ; break ; case ImagesServiceError \ ErrorCode :: BAD_IMAGE_DATA : $ result = new CloudStorageException ( 'Bad image data.' ) ; break ; case ImagesServiceError \ ErrorCode :: IMAGE_TOO_LARGE : $ result = new CloudStorageException ( 'Image too large.' ) ; break ; case ImagesServiceError \ ErrorCode :: INVALID_BLOB_KEY : $ result = new CloudStorageException ( 'Invalid blob key for image.' ) ; break ; case ImagesServiceError \ ErrorCode :: ACCESS_DENIED : $ result = new CloudStorageException ( 'Access denied to image.' ) ; break ; case ImagesServiceError \ ErrorCode :: OBJECT_NOT_FOUND : $ result = new CloudStorageException ( 'Image object not found.' ) ; break ; default : $ result = new CloudStorageException ( 'Images Error Code: ' . $ error -> getApplicationError ( ) ) ; } return $ result ; }
Convert an ImagesServiceError returned from an RPC call to an exception.

@param int $error A ImagesServiceError::ErrorCode error value.

@return Exception The exception that corresponds to the error code.

@access private
Convert an ImagesServiceError returned from an RPC call to an exception .