本文整理汇总了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();
}