本文整理汇总了Java中com.facebook.FacebookException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java FacebookException.getMessage方法的具体用法?Java FacebookException.getMessage怎么用?Java FacebookException.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.FacebookException
的用法示例。
在下文中一共展示了FacebookException.getMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onWebDialogComplete
import com.facebook.FacebookException; //导入方法依赖的package包/类
void onWebDialogComplete(LoginClient.Request request, Bundle values,
FacebookException error) {
LoginClient.Result outcome;
if (values != null) {
// Actual e2e we got from the dialog should be used for logging.
if (values.containsKey(ServerProtocol.DIALOG_PARAM_E2E)) {
e2e = values.getString(ServerProtocol.DIALOG_PARAM_E2E);
}
try {
AccessToken token = createAccessTokenFromWebBundle(
request.getPermissions(),
values,
AccessTokenSource.WEB_VIEW,
request.getApplicationId());
outcome = LoginClient.Result.createTokenResult(
loginClient.getPendingRequest(),
token);
// Ensure any cookies set by the dialog are saved
// This is to work around a bug where CookieManager may fail to instantiate if
// CookieSyncManager has never been created.
CookieSyncManager syncManager =
CookieSyncManager.createInstance(loginClient.getActivity());
syncManager.sync();
saveCookieToken(token.getToken());
} catch (FacebookException ex) {
outcome = LoginClient.Result.createErrorResult(
loginClient.getPendingRequest(),
null,
ex.getMessage());
}
} else {
if (error instanceof FacebookOperationCanceledException) {
outcome = LoginClient.Result.createCancelResult(loginClient.getPendingRequest(),
"User canceled log in.");
} else {
// Something went wrong, don't log a completion event since it will skew timing
// results.
e2e = null;
String errorCode = null;
String errorMessage = error.getMessage();
if (error instanceof FacebookServiceException) {
FacebookRequestError requestError =
((FacebookServiceException)error).getRequestError();
errorCode = String.format(Locale.ROOT, "%d", requestError.getErrorCode());
errorMessage = requestError.toString();
}
outcome = LoginClient.Result.createErrorResult(loginClient.getPendingRequest(),
null, errorMessage, errorCode);
}
}
if (!Utility.isNullOrEmpty(e2e)) {
logWebLoginCompleted(e2e);
}
loginClient.completeAndValidate(outcome);
}