當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。