return useful messages for wrapped exceptions

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1239453 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2012-02-02 03:13:32 +00:00
parent f6e4fceda2
commit 0456daf3bb
1 changed files with 8 additions and 1 deletions

View File

@ -346,6 +346,12 @@ public class SolrDispatchFilter implements Filter
code = ((SolrException)ex).code();
}
String msg = null;
for (Throwable th = ex; th != null; th = th.getCause()) {
msg = th.getMessage();
if (msg != null) break;
}
// For any regular code, don't include the stack trace
if( code == 500 || code < 100 ) {
StringWriter sw = new StringWriter();
@ -360,7 +366,8 @@ public class SolrDispatchFilter implements Filter
code = 500;
}
}
res.sendError( code, ex.getMessage() + trace );
res.sendError( code, msg + trace );
}
//---------------------------------------------------------------------