yuxc
2023-04-14 f2e6e77dc5a984e2fec4416717baa7c47118fcb1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.vci.ubcs.com.vci.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();
        }
    }
}