Pre Merge pull request !501 from EFT/dev-ExceptionUtil
This commit is contained in:
commit
7fabf6d534
|
|
@ -11,6 +11,9 @@ import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||||
*/
|
*/
|
||||||
public class ExceptionUtil
|
public class ExceptionUtil
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private ExceptionUtil() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取exception的详细错误信息。
|
* 获取exception的详细错误信息。
|
||||||
*/
|
*/
|
||||||
|
|
@ -24,16 +27,10 @@ public class ExceptionUtil
|
||||||
public static String getRootErrorMessage(Exception e)
|
public static String getRootErrorMessage(Exception e)
|
||||||
{
|
{
|
||||||
Throwable root = ExceptionUtils.getRootCause(e);
|
Throwable root = ExceptionUtils.getRootCause(e);
|
||||||
root = (root == null ? e : root);
|
if (null == root)
|
||||||
if (root == null)
|
|
||||||
{
|
{
|
||||||
return "";
|
return StringUtils.EMPTY;
|
||||||
}
|
}
|
||||||
String msg = root.getMessage();
|
return StringUtils.defaultString(root.getMessage(), "null");
|
||||||
if (msg == null)
|
|
||||||
{
|
|
||||||
return "null";
|
|
||||||
}
|
|
||||||
return StringUtils.defaultString(msg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue