Destiny.Lin
2 years ago
2 changed files with 43 additions and 3 deletions
@ -0,0 +1,37 @@
|
||||
package com.fr.design.mainframe.vcs; |
||||
|
||||
import com.fr.design.i18n.Toolkit; |
||||
|
||||
import java.io.IOException; |
||||
import java.util.HashMap; |
||||
|
||||
/** |
||||
* 版本管理异常处理工具类 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @since 11.0 |
||||
* Created on 2023/7/24 |
||||
*/ |
||||
public class VcsExceptionUtils { |
||||
|
||||
public static final HashMap<Class, String> EXCEPTION_MAP = new HashMap<Class, String>() { |
||||
{ |
||||
put(IOException.class, Toolkit.i18nText("Fine-Design_Vcs_Exception_IO")); |
||||
put(UnsupportedOperationException.class, Toolkit.i18nText("Fine-Design_Vcs_Exception_Un_Support")); |
||||
} |
||||
}; |
||||
|
||||
|
||||
/** |
||||
* 根据异常返回结果描述文案 |
||||
*/ |
||||
public static String createDetailByException(Exception e) { |
||||
for (Class key : EXCEPTION_MAP.keySet()) { |
||||
if (key.isAssignableFrom(e.getClass())) { |
||||
return EXCEPTION_MAP.get(key); |
||||
} |
||||
} |
||||
return Toolkit.i18nText("Fine-Design_Vcs_Exception_Unknown"); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue