mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-06-07 16:39:55 +08:00
fix(i18n): Update log messages to English and improve error handling in bot initialization and storage loading
This commit is contained in:
@@ -47,12 +47,12 @@ var storageConstructors = map[storenum.StorageType]StorageConstructor{
|
||||
func NewStorage(ctx context.Context, cfg storcfg.StorageConfig) (Storage, error) {
|
||||
constructor, ok := storageConstructors[cfg.GetType()]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("不支持的存储类型: %s", cfg.GetType())
|
||||
return nil, fmt.Errorf("unsupported storage type: %s", cfg.GetType())
|
||||
}
|
||||
|
||||
storage := constructor()
|
||||
if err := storage.Init(ctx, cfg); err != nil {
|
||||
return nil, fmt.Errorf("初始化 %s 存储失败: %w", cfg.GetName(), err)
|
||||
return nil, fmt.Errorf("failed to initialize storage %s: %w", cfg.GetName(), err)
|
||||
}
|
||||
|
||||
return storage, nil
|
||||
|
||||
Reference in New Issue
Block a user