mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-07-30 19:22:58 +08:00
Merge remote-tracking branch 'origin/developing' into developing
This commit is contained in:
@ -0,0 +1,25 @@
|
||||
package ai.chat2db.server.tools.common.exception;
|
||||
|
||||
import ai.chat2db.server.tools.base.excption.BusinessException;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class ConnectionException extends BusinessException {
|
||||
|
||||
|
||||
public ConnectionException() {
|
||||
this("connection.error");
|
||||
}
|
||||
|
||||
public ConnectionException(String code) {
|
||||
this(code, null);
|
||||
}
|
||||
|
||||
public ConnectionException(String code, Object[] args) {
|
||||
super(code,args);
|
||||
}
|
||||
|
||||
public ConnectionException(String code, Object[] args, Throwable throwable) {
|
||||
super(code,args, throwable);
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package ai.chat2db.server.tools.common.util;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
@ -9,8 +11,6 @@ import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* i18n utility
|
||||
*
|
||||
@ -19,7 +19,7 @@ import java.util.Locale;
|
||||
@Slf4j
|
||||
@Component
|
||||
public class I18nUtils implements InitializingBean {
|
||||
public static final String DEFAULT_message_Code="";
|
||||
public static final String DEFAULT_message_Code="common.systemError";
|
||||
@Resource
|
||||
private MessageSource messageSource;
|
||||
private static MessageSource messageSourceStatic;
|
||||
@ -34,7 +34,7 @@ public class I18nUtils implements InitializingBean {
|
||||
} catch (NoSuchMessageException e) {
|
||||
log.error("no message.", e);
|
||||
}
|
||||
return messageSourceStatic.getMessage(messageCode, args, LocaleContextHolder.getLocale());
|
||||
return messageSourceStatic.getMessage(DEFAULT_message_Code, args, LocaleContextHolder.getLocale());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user