本文整理汇总了Java中com.google.api.client.googleapis.json.GoogleJsonError.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java GoogleJsonError.getMessage方法的具体用法?Java GoogleJsonError.getMessage怎么用?Java GoogleJsonError.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.api.client.googleapis.json.GoogleJsonError
的用法示例。
在下文中一共展示了GoogleJsonError.getMessage方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: logAndShow
import com.google.api.client.googleapis.json.GoogleJsonError; //导入方法依赖的package包/类
/**
* Logs the given throwable and shows an error alert dialog with its
* message.
*
* @param activity
* activity
* @param tag
* log tag to use
* @param t
* throwable to log and show
*/
public static void logAndShow(Activity activity, String tag, Throwable t) {
Log.e(tag, "Error", t);
String message = t.getMessage();
if (t instanceof GoogleJsonResponseException) {
GoogleJsonError details = ((GoogleJsonResponseException) t)
.getDetails();
if (details != null) {
message = details.getMessage();
}
} else if (t.getCause() instanceof OperationCanceledException) {
message = ((OperationCanceledException) t.getCause()).getMessage();
} else if (t.getCause() instanceof GoogleAuthException) {
message = ((GoogleAuthException) t.getCause()).getMessage();
} else if (t instanceof IOException) {
if (t.getMessage() == null) {
message = "IOException";
}
}
Log.d(tag, message);
ToastHelper.showErrorToast(activity,
activity.getResources().getString(R.string.error));
}
示例2: createStagingLocation
import com.google.api.client.googleapis.json.GoogleJsonError; //导入方法依赖的package包/类
/**
* Uses the provided specification for the staging location, creating it if it does not already
* exist. This may be a long-running blocking operation.
*/
public StagingLocationVerificationResult createStagingLocation(
String projectId, String stagingLocation, IProgressMonitor progressMonitor) {
SubMonitor monitor = SubMonitor.convert(progressMonitor, 2);
String bucketName = toGcsBucketName(stagingLocation);
if (locationIsAccessible(stagingLocation)) { // bucket already exists
return new StagingLocationVerificationResult(
String.format("Bucket %s exists", bucketName), true);
}
monitor.worked(1);
// else create the bucket
try {
Bucket newBucket = new Bucket();
newBucket.setName(bucketName);
gcsClient.buckets().insert(projectId, newBucket).execute();
return new StagingLocationVerificationResult(
String.format("Bucket %s created", bucketName), true);
} catch (GoogleJsonResponseException ex) {
GoogleJsonError error = ex.getDetails();
return new StagingLocationVerificationResult(error.getMessage(), false);
} catch (IOException e) {
return new StagingLocationVerificationResult(e.getMessage(), false);
} finally {
monitor.done();
}
}
示例3: logAndShow
import com.google.api.client.googleapis.json.GoogleJsonError; //导入方法依赖的package包/类
/**
* Logs the given throwable and shows an error alert dialog with its message.
*
* @param activity activity
* @param tag log tag to use
* @param t throwable to log and show
*/
public static void logAndShow(Activity activity, String tag, Throwable t) {
Log.e(tag, "Error", t);
String message = t.getMessage();
if (t instanceof GoogleJsonResponseException) {
GoogleJsonError details = ((GoogleJsonResponseException) t).getDetails();
if (details != null) {
message = details.getMessage();
}
} else if (t.getCause() instanceof GoogleAuthException) {
message = ((GoogleAuthException) t.getCause()).getMessage();
}
showError(activity, message);
}
示例4: logAndShow
import com.google.api.client.googleapis.json.GoogleJsonError; //导入方法依赖的package包/类
/**
* Logs the given throwable and shows an error alert dialog with its
* message.
*
* @param activity activity
* @param tag log tag to use
* @param t throwable to log and show
*/
public static void logAndShow(Activity activity, String tag, Throwable t) {
Log.e(tag, "Error", t);
String message = t.getMessage();
if (t instanceof GoogleJsonResponseException) {
GoogleJsonError details = ((GoogleJsonResponseException) t).getDetails();
if (details != null) {
message = details.getMessage();
}
}
showError(activity, message);
}
示例5: logAndShow
import com.google.api.client.googleapis.json.GoogleJsonError; //导入方法依赖的package包/类
/**
* Logs the given throwable and shows an error alert dialog with its message.
*
* @param activity activity
* @param tag log tag to use
* @param t throwable to log and show
*/
public static void logAndShow(Activity activity, String tag, Throwable t) {
Log.e(tag, "Error", t);
String message = t.getMessage();
if (t instanceof GoogleJsonResponseException) {
GoogleJsonError details = ((GoogleJsonResponseException) t).getDetails();
if (details != null) {
message = details.getMessage();
}
} else if (t.getCause() instanceof GoogleAuthException) {
message = ((GoogleAuthException) t.getCause()).getMessage();
}
showError(activity, message);
}
示例6: logAndShow
import com.google.api.client.googleapis.json.GoogleJsonError; //导入方法依赖的package包/类
/**
* Logs the given throwable and shows an error alert dialog with its
* message.
*
* @param activity
* activity
* @param tag
* log tag to use
* @param t
* throwable to log and show
*/
public static void logAndShow(Activity activity, String tag, Throwable t) {
Log.e(tag, "Error", t);
String message = t.getMessage();
// Exceptions that occur in your Cloud Endpoint implementation classes
// are wrapped as GoogleJsonResponseExceptions
if (t instanceof GoogleJsonResponseException) {
GoogleJsonError details = ((GoogleJsonResponseException) t)
.getDetails();
if (details != null) {
message = details.getMessage();
}
}
showError(activity, message);
}
示例7: logAndShow
import com.google.api.client.googleapis.json.GoogleJsonError; //导入方法依赖的package包/类
/**
* Logs the given throwable and shows an error alert dialog with its message.
*
* @param activity
* activity
* @param tag
* log tag to use
* @param t
* throwable to log and show
*/
public static void logAndShow(Activity activity, String tag, Throwable t) {
Log.e(tag, "Error", t);
String message = t.getMessage();
if (t instanceof GoogleJsonResponseException) {
GoogleJsonError details = ((GoogleJsonResponseException) t).getDetails();
if (details != null) {
message = details.getMessage();
}
}
showError(activity, message);
}
示例8: logAndShow
import com.google.api.client.googleapis.json.GoogleJsonError; //导入方法依赖的package包/类
/**
* Logs the given throwable and shows an error alert dialog with its
* message.
*
* @param activity activity
* @param tag log tag to use
* @param t throwable to log and show
*/
public static void logAndShow(Activity activity, String tag, Throwable t) {
Log.e(tag, "Error", t);
String message = t.getMessage();
// Exceptions that occur in your Cloud Endpoint implementation classes
// are wrapped as GoogleJsonResponseExceptions
if (t instanceof GoogleJsonResponseException) {
GoogleJsonError details = ((GoogleJsonResponseException) t)
.getDetails();
if (details != null) {
message = details.getMessage();
}
}
showError(activity, message);
}
示例9: logAndShow
import com.google.api.client.googleapis.json.GoogleJsonError; //导入方法依赖的package包/类
/**
* Logs the given throwable and shows an error alert dialog with its message.
*
* @param activity activity
* @param tag log tag to use
* @param t throwable to log and show
*/
public static void logAndShow(Activity activity, String tag, Throwable t) {
Log.e(tag, "Error", t);
String message = t.getMessage();
if (t instanceof GoogleJsonResponseException) {
GoogleJsonError details = ((GoogleJsonResponseException) t).getDetails();
if (details != null) {
message = details.getMessage();
}
}
showError(activity, message);
}
开发者ID:GoogleCloudPlatform,项目名称:solutions-cloud-adventure-sample-android-client,代码行数:19,代码来源:CloudEndpointUtils.java
示例10: logAndShow
import com.google.api.client.googleapis.json.GoogleJsonError; //导入方法依赖的package包/类
/**
* Logs the given throwable and shows an error alert dialog with its message.
*
* @param activity activity
* @param tag log tag to use
* @param t throwable to log and show
*/
public static void logAndShow(Activity activity, String tag, Throwable t) {
Log.e(tag, "Error", t);
String message = t.getMessage();
if (t instanceof GoogleJsonResponseException) {
GoogleJsonError details = ((GoogleJsonResponseException) t).getDetails();
if (details != null) {
message = details.getMessage();
}
} else if (t.getCause() instanceof GoogleAuthException) {
message = ((GoogleAuthException) t.getCause()).getMessage();
}
showError(activity, message);
}
示例11: create
import com.google.api.client.googleapis.json.GoogleJsonError; //导入方法依赖的package包/类
/** Create an error for JSON server response errors. */
public static BigqueryJobFailureException create(GoogleJsonError error) {
return new BigqueryJobFailureException(error.getMessage(), null, null, error);
}