package com.vci.ubcs.starter.web.util;
|
|
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.Method;
|
|
public class LangBaseUtil {
|
public LangBaseUtil() {
|
}
|
|
public static String getErrorMsg(Throwable e) {
|
if (e == null) {
|
return "未知错误";
|
} else {
|
if (e.getClass() != null && e.getClass().getSuperclass() != null && (e.getClass().getSuperclass().equals(RuntimeException.class) || e.getClass().getSuperclass().getName().endsWith(".VciBaseException") || e.getClass().getName().endsWith(".VciBaseException"))) {
|
try {
|
Method errorMethod = e.getClass().getMethod("getErrorMsg");
|
if (errorMethod != null) {
|
return (String)errorMethod.invoke(e);
|
}
|
} catch (NoSuchMethodException var2) {
|
return e.getMessage();
|
} catch (IllegalAccessException var3) {
|
return e.getMessage();
|
} catch (InvocationTargetException var4) {
|
return e.getMessage();
|
}
|
}
|
|
return e.getMessage();
|
}
|
}
|
}
|