mirror of https://gitee.com/stylefeng/roses
【pinyin】更新拼音模块异常
parent
13877758f9
commit
98ee4d2484
|
@ -1,5 +1,6 @@
|
|||
package cn.stylefeng.roses.kernel.pinyin.api.exception;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.stylefeng.roses.kernel.pinyin.api.constants.PinyinConstants;
|
||||
import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum;
|
||||
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
|
||||
|
@ -14,12 +15,12 @@ import lombok.Getter;
|
|||
@Getter
|
||||
public class PinyinException extends ServiceException {
|
||||
|
||||
public PinyinException(AbstractExceptionEnum exceptionEnum, String userTip) {
|
||||
super(PinyinConstants.PINYIN_MODULE_NAME, exceptionEnum.getErrorCode(), userTip);
|
||||
}
|
||||
|
||||
public PinyinException(AbstractExceptionEnum exceptionEnum) {
|
||||
super(PinyinConstants.PINYIN_MODULE_NAME, exceptionEnum);
|
||||
}
|
||||
|
||||
public PinyinException(AbstractExceptionEnum exception, Object... params) {
|
||||
super(PinyinConstants.PINYIN_MODULE_NAME, exception.getErrorCode(), StrUtil.format(exception.getUserTip(), params));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package cn.stylefeng.roses.kernel.pinyin;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.stylefeng.roses.kernel.pinyin.api.PinYinApi;
|
||||
import cn.stylefeng.roses.kernel.pinyin.api.exception.PinyinException;
|
||||
import net.sourceforge.pinyin4j.PinyinHelper;
|
||||
|
@ -107,8 +106,7 @@ public class PinyinServiceImpl implements PinYinApi {
|
|||
}
|
||||
return finalPinyinString.toString();
|
||||
} catch (BadHanyuPinyinOutputFormatCombination e1) {
|
||||
String userTip = StrUtil.format(PARSE_ERROR.getUserTip(), e1.getMessage());
|
||||
throw new PinyinException(PARSE_ERROR, userTip);
|
||||
throw new PinyinException(PARSE_ERROR, e1.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,8 +180,7 @@ public class PinyinServiceImpl implements PinYinApi {
|
|||
}
|
||||
}
|
||||
} catch (BadHanyuPinyinOutputFormatCombination e) {
|
||||
String userTip = StrUtil.format(PARSE_ERROR.getUserTip(), e.getMessage());
|
||||
throw new PinyinException(PARSE_ERROR, userTip);
|
||||
throw new PinyinException(PARSE_ERROR, e.getMessage());
|
||||
}
|
||||
|
||||
return hanyupinyin.toString();
|
||||
|
|
Loading…
Reference in New Issue