本文整理汇总了Java中org.sdnplatform.sync.thrift.SyncError.setMessage方法的典型用法代码示例。如果您正苦于以下问题:Java SyncError.setMessage方法的具体用法?Java SyncError.setMessage怎么用?Java SyncError.setMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sdnplatform.sync.thrift.SyncError
的用法示例。
在下文中一共展示了SyncError.setMessage方法的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;
}