当前位置: 首页>>代码示例>>Java>>正文


Java GoogleJsonResponseException.getMessage方法代码示例

本文整理汇总了Java中com.google.api.client.googleapis.json.GoogleJsonResponseException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java GoogleJsonResponseException.getMessage方法的具体用法?Java GoogleJsonResponseException.getMessage怎么用?Java GoogleJsonResponseException.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.api.client.googleapis.json.GoogleJsonResponseException的用法示例。


在下文中一共展示了GoogleJsonResponseException.getMessage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertException

import com.google.api.client.googleapis.json.GoogleJsonResponseException; //导入方法依赖的package包/类
private Exception convertException(Exception e) {
	logDebug("Exception: " + e.toString());
	e.printStackTrace();
	if (UserRecoverableAuthIOException.class.isAssignableFrom(e.getClass()))
	{
		logDebug("clearing account data.");
		//this is not really nice because it removes data from the cache which might still be valid but we don't have the account name here...
		mAccountData.clear();
	}
	if (GoogleJsonResponseException.class.isAssignableFrom(e.getClass()) )
	{
		GoogleJsonResponseException jsonEx = (GoogleJsonResponseException)e;
		if (jsonEx.getDetails().getCode() == 404)
			return new FileNotFoundException(jsonEx.getMessage());
	}
	
	return e;
	
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:20,代码来源:GoogleDriveFileStorage.java

示例2: readBlob

import com.google.api.client.googleapis.json.GoogleJsonResponseException; //导入方法依赖的package包/类
/**
 * Returns an {@link java.io.InputStream} for a given blob
 *
 * @param blobName name of the blob
 * @return an InputStream
 */
InputStream readBlob(String blobName) throws IOException {
    try {
        return SocketAccess.doPrivilegedIOException(() -> {
            Storage.Objects.Get object = client.objects().get(bucket, blobName);
            return object.executeMediaAsInputStream();
        });
    } catch (GoogleJsonResponseException e) {
        GoogleJsonError error = e.getDetails();
        if ((e.getStatusCode() == HTTP_NOT_FOUND) || ((error != null) && (error.getCode() == HTTP_NOT_FOUND))) {
            throw new NoSuchFileException(e.getMessage());
        }
        throw e;
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:GoogleCloudStorageBlobStore.java

示例3: from

import com.google.api.client.googleapis.json.GoogleJsonResponseException; //导入方法依赖的package包/类
/**
 * Static builder to construct a {@code GoogleApiException} from a {@link
 * GoogleJsonResponseException}
 *
 * @param exception a GoogleJsonResponseException that was thrown by a Google API call
 */
public static GoogleApiException from(GoogleJsonResponseException exception) {
  String message =
      exception.getDetails() != null
          ? exception.getDetails().getMessage()
          : exception.getMessage();
  return new GoogleApiException(message, exception, exception.getStatusCode());
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:14,代码来源:GoogleApiException.java


注:本文中的com.google.api.client.googleapis.json.GoogleJsonResponseException.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。