本文整理汇总了Java中org.sdnplatform.sync.thrift.SyncError类的典型用法代码示例。如果您正苦于以下问题:Java SyncError类的具体用法?Java SyncError怎么用?Java SyncError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SyncError类属于org.sdnplatform.sync.thrift包,在下文中一共展示了SyncError类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getError
import org.sdnplatform.sync.thrift.SyncError; //导入依赖的package包/类
/**
* Generate an error message from the provided transaction ID and
* exception
* @param transactionId the transaction Id
* @param error the exception
* @param type the type of the message that generated the error
* @return the {@link SyncError} message
*/
protected SyncMessage getError(int transactionId, Exception error,
MessageType type) {
int ec = SyncException.ErrorType.GENERIC.getValue();
if (error instanceof SyncException) {
ec = ((SyncException)error).getErrorType().getValue();
} else {
logger.error("Unexpected error processing message " + transactionId
+ "(" + type + ")", error);
}
SyncError m = new SyncError();
m.setErrorCode(ec);
m.setMessage(error.getMessage());
ErrorMessage em = new ErrorMessage();
em.setError(m);
em.setType(type);
AsyncMessageHeader header = new AsyncMessageHeader();
header.setTransactionId(transactionId);
em.setHeader(header);
SyncMessage bsm = new SyncMessage(MessageType.ERROR);
bsm.setError(em);
return bsm;
}
示例2: getError
import org.sdnplatform.sync.thrift.SyncError; //导入依赖的package包/类
/**
* Generate an error message from the provided transaction ID and
* exception
* @param transactionId the transaction Id
* @param error the exception
* @param type the type of the message that generated the error
* @return the {@link SyncError} message
*/
protected SyncMessage getError(int transactionId, Exception error,
MessageType type) {
int ec = SyncException.ErrorType.GENERIC.getValue();
if (error instanceof SyncException) {
ec = ((SyncException)error).getErrorType().getValue();
} else {
logger.error("Unexpected error processing message " + transactionId
+ "(" + type + ")", error);
}
SyncError m = new SyncError();
m.setErrorCode(ec);
m.setMessage(error.getMessage());
ErrorMessage em = new ErrorMessage();
em.setError(m);
em.setType(type);
AsyncMessageHeader header = new AsyncMessageHeader();
header.setTransactionId(transactionId);
em.setHeader(header);
SyncMessage bsm = new SyncMessage(MessageType.ERROR);
bsm.setError(em);
return bsm;
}
示例3: getError
import org.sdnplatform.sync.thrift.SyncError; //导入依赖的package包/类
/**
* Generate an error message from the provided transaction ID and
* exception
* @param transactionId the transaction Id
* @param error the exception
* @param type the type of the message that generated the error
* @return the {@link SyncError} message
*/
@LogMessageDoc(level="ERROR",
message="Unexpected error processing message {} ({})",
explanation="An error occurred while processing an " +
"RPC message",
recommendation=LogMessageDoc.GENERIC_ACTION)
protected SyncMessage getError(int transactionId, Exception error,
MessageType type) {
int ec = SyncException.ErrorType.GENERIC.getValue();
if (error instanceof SyncException) {
ec = ((SyncException)error).getErrorType().getValue();
} else {
logger.error("Unexpected error processing message " + transactionId
+ "(" + type + ")", error);
}
SyncError m = new SyncError();
m.setErrorCode(ec);
m.setMessage(error.getMessage());
ErrorMessage em = new ErrorMessage();
em.setError(m);
em.setType(type);
AsyncMessageHeader header = new AsyncMessageHeader();
header.setTransactionId(transactionId);
em.setHeader(header);
SyncMessage bsm = new SyncMessage(MessageType.ERROR);
bsm.setError(em);
return bsm;
}