本文整理了Java中com.yahoo.yolean.Exceptions.toMessageString()
方法的一些代码示例,展示了Exceptions.toMessageString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Exceptions.toMessageString()
方法的具体详情如下:
包路径:com.yahoo.yolean.Exceptions
类名称:Exceptions
方法名:toMessageString
[英]Returns a user friendly error message string which includes information from all nested exceptions.
The form of this string is e.getMessage(): e.getCause().getMessage(): e.getCause().getCause().getMessage()...
In addition, some heuristics are used to clean up common cases where exception nesting causes bad messages.
[中]返回用户友好的错误消息字符串,其中包含来自所有嵌套异常的信息。
此字符串的形式为e.getMessage(): e.getCause().getMessage(): e.getCause().getCause().getMessage()...
此外,一些启发式方法用于清除异常嵌套导致错误消息的常见情况。
代码示例来源:origin: com.yahoo.vespa/container-search
private void logWarning(String attemptDescription, Exception e) {
log.log(Level.WARNING, "Exception on " + attemptDescription + " '" + host + ":" + port + "': " + Exceptions.toMessageString(e));
}
代码示例来源:origin: com.yahoo.vespa/container-core
@Override
public void failed(Throwable throwable) {
long endTime = System.currentTimeMillis();
writeToLogs(endTime);
if (log.isLoggable(LogLevel.DEBUG)) {
log.log(LogLevel.DEBUG, "Got exception when writing to client: " + Exceptions.toMessageString(throwable));
}
}
代码示例来源:origin: com.yahoo.vespa/container-core
/**
* Flush the internal buffers, does not touch the ContentChannel.
*/
@Override
public void flush() throws IOException {
try {
buffer.flush();
} catch (RuntimeException e) {
throw new IOException(Exceptions.toMessageString(e), e);
}
}
代码示例来源:origin: com.yahoo.vespa/config-model
private void validateWarn(Exception e, DeployLogger deployLogger) {
String msg = "Unable to execute 'vespa-verify-ranksetup', validation of rank expressions will only take place when you start Vespa: " +
Exceptions.toMessageString(e);
deployLogger.log(LogLevel.WARNING, msg);
}
代码示例来源:origin: com.yahoo.vespa/container-search
private ErrorMessage createExecutionError(Exception e) {
log.log(Level.WARNING,"Exception on executing " + execution + " for " + query,e);
return ErrorMessage.createErrorInPluginSearcher("Error in '" + execution + "': " + Exceptions.toMessageString(e),
e.getCause());
}
代码示例来源:origin: com.yahoo.vespa/container-core
/**
* Buffered write of a single byte.
*/
@Override
public void write(final int b) throws IOException {
try {
buffer.append((byte) b);
} catch (RuntimeException e) {
throw new IOException(Exceptions.toMessageString(e), e);
}
}
代码示例来源:origin: com.yahoo.vespa/container-core
/**
* Buffered write the contents of the array to this stream,
* <i>transferring</i> ownership of that array to this stream. It is in
* other words <i>not</i> safe to recycle the array {@code b}.
*/
public void nonCopyingWrite(final byte[] b) throws IOException {
try {
buffer.append(b);
} catch (RuntimeException e) {
throw new IOException(Exceptions.toMessageString(e), e);
}
}
代码示例来源:origin: com.yahoo.vespa/config-application-package
private String message(SAXParseException e) {
return "XML error in " + fileName + ": " +
Exceptions.toMessageString(e)
+ " [" + e.getLineNumber() + ":" + e.getColumnNumber() + "]" +
", input:\n" + getErrorContext(e.getLineNumber());
}
代码示例来源:origin: com.yahoo.vespa/container-search
private ErrorMessage createInterruptedError(Exception e) {
return ErrorMessage.createUnspecifiedError("'" + execution + "' was interrupted while executing: " +
Exceptions.toMessageString(e));
}
代码示例来源:origin: com.yahoo.vespa/config-application-package
public void validate(InputSource inputSource, String fileName) throws IOException {
errorHandler.fileName = (fileName == null ? "input" : fileName);
errorHandler.reader = inputSource.getCharacterStream();
try {
if ( ! driver.validate(inputSource)) {
// Shouldn't happen, error handler should have thrown
throw new RuntimeException("Aborting due to earlier XML errors.");
}
} catch (SAXException e) {
// This should never happen, as it is handled by the ErrorHandler
// installed for the driver.
throw new IllegalArgumentException("XML error in " + errorHandler.fileName + ": " + Exceptions.toMessageString(e));
}
}
代码示例来源:origin: com.yahoo.vespa/container-core
/**
* Flush the internal buffers, does not touch the ContentChannel.
*/
@Override
public void close() throws IOException {
// the endpoint is closed in a finally{} block inside AbstractHttpRequestHandler
// this class should be possible to close willynilly as it is exposed to plug-ins
try {
buffer.flush();
} catch (RuntimeException e) {
throw new IOException(Exceptions.toMessageString(e), e);
}
}
代码示例来源:origin: com.yahoo.vespa/container-core
/**
* Buffered write of the contents of the array to this stream,
* <i>transferring</i> ownership of that array to this stream. It is in
* other words <i>not</i> safe to recycle the array {@code b}.
*/
public void nonCopyingWrite(final byte[] b, final int off, final int len)
throws IOException {
try {
buffer.append(b, off, len);
} catch (RuntimeException e) {
throw new IOException(Exceptions.toMessageString(e), e);
}
}
代码示例来源:origin: com.yahoo.vespa/clustercontroller-utils
private static void logRequestException(HttpRequest request, Exception exception, Level level) {
String exceptionString = Exceptions.toMessageString(exception);
log.log(level, "Failed to process request with URI path " + request.getPath() + ": " + exceptionString);
}
代码示例来源:origin: com.yahoo.vespa/container-search
public static void main(String... args) {
try {
System.out.print(new DumpTool().resolveAndDump(args));
}
catch (Exception e) {
System.err.println(Exceptions.toMessageString(e));
}
}
代码示例来源:origin: com.yahoo.vespa/container-search
private HttpResponse illegalQueryResponse(HttpRequest request, RuntimeException e) {
return errorResponse(request, ErrorMessage.createIllegalQuery(Exceptions.toMessageString(e)));
}
代码示例来源:origin: com.yahoo.vespa/container-search
private HttpResponse internalServerErrorResponse(HttpRequest request, RuntimeException e) {
return errorResponse(request, ErrorMessage.createInternalServerError(Exceptions.toMessageString(e)));
}
代码示例来源:origin: com.yahoo.vespa/container-search
private HttpResponse invalidParameterResponse(HttpRequest request, RuntimeException e) {
return errorResponse(request, ErrorMessage.createInvalidQueryParameter(Exceptions.toMessageString(e)));
}
代码示例来源:origin: com.yahoo.vespa/container-search
public Pong call() {
try {
Pong pong = FastSearcher.ping(new Ping(clusterMonitor.getConfiguration().getRequestTimeout()),
fs4ResourcePool.getBackend(node.hostname(), node.fs4port()), node.toString());
if (pong.activeDocuments().isPresent())
node.setActiveDocuments(pong.activeDocuments().get());
return pong;
} catch (RuntimeException e) {
return new Pong(ErrorMessage.createBackendCommunicationError("Exception when pinging " + node + ": "
+ Exceptions.toMessageString(e)));
}
}
代码示例来源:origin: com.yahoo.vespa/vespaclient-container-plugin
static DocumentOperationMessageV3 newErrorMessage(String operationId, Exception exception) {
Message feedErrorMessageV3 = new FeedErrorMessage(operationId);
DocumentOperationMessageV3 msg = new DocumentOperationMessageV3(operationId, feedErrorMessageV3);
Hop hop = new Hop();
hop.addDirective(new ErrorDirective(Exceptions.toMessageString(exception)));
Route route = new Route();
route.addHop(hop);
feedErrorMessageV3.setRoute(route);
return msg;
}
代码示例来源:origin: com.yahoo.vespa/config-model
private String importString(String str, String searchDefDir, DeployLogger deployLogger) throws ParseException {
Search search;
SimpleCharStream stream = new SimpleCharStream(str);
try {
search = new SDParser(stream, deployLogger, app, rankProfileRegistry, documentsOnly).search(docTypeMgr, searchDefDir);
} catch (TokenMgrException e) {
throw new ParseException("Unknown symbol: " + e.getMessage());
} catch (ParseException pe) {
throw new ParseException(stream.formatException(Exceptions.toMessageString(pe)));
}
return importRawSearch(search);
}
内容来源于网络,如有侵权,请联系作者删除!