本文整理匯總了Java中com.sforce.soap.partner.fault.ApiFault類的典型用法代碼示例。如果您正苦於以下問題:Java ApiFault類的具體用法?Java ApiFault怎麽用?Java ApiFault使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ApiFault類屬於com.sforce.soap.partner.fault包,在下文中一共展示了ApiFault類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: wrapException
import com.sforce.soap.partner.fault.ApiFault; //導入依賴的package包/類
/**
* Wraps a checked exception thrown by Salesforce into an
* {@link IllegalStateException} with a useful message.
*
* @param e
* @param whatWentWrong
* @return
*/
public static IllegalStateException wrapException(ConnectionException e, String whatWentWrong) {
logger.error("Wrapping Salesforce.com ConnectionException", e);
String message = null;
Throwable cause = e;
while (message == null && cause != null) {
if (cause instanceof ApiFault) {
final String exceptionMessage = ((ApiFault) cause).getExceptionMessage();
final ExceptionCode exceptionCode = ((ApiFault) cause).getExceptionCode();
message = exceptionCode + ": " + exceptionMessage;
break;
}
cause = cause.getCause();
}
throw new IllegalStateException(whatWentWrong + ": " + message, cause);
}
示例2: sendChunkToError
import com.sforce.soap.partner.fault.ApiFault; //導入依賴的package包/類
private static void sendChunkToError(
String[] ids,
ListMultimap<String, Record> recordsToRetrieve,
ToErrorContext context,
ApiFault e
) {
for (String id : ids) {
for (Record record : recordsToRetrieve.get(id)) {
context.toError(record, e);
}
}
}
示例3: getExceptionCode
import com.sforce.soap.partner.fault.ApiFault; //導入依賴的package包/類
public static String getExceptionCode(Throwable th) {
return (th instanceof ApiFault) ? ((ApiFault) th).getExceptionCode().name() : "";
}
示例4: getExceptionMessage
import com.sforce.soap.partner.fault.ApiFault; //導入依賴的package包/類
public static String getExceptionMessage(Throwable th) {
return (th instanceof ApiFault) ? ((ApiFault) th).getExceptionMessage() : th.getMessage();
}