changes for error in request flow

This commit is contained in:
MohitKatare-protean
2025-04-03 15:31:55 +05:30
parent 1b97457cc9
commit cf4b397249
4 changed files with 16 additions and 15 deletions

View File

@@ -178,12 +178,12 @@ func loadKeyManager(ctx context.Context, mgr PluginManager, cache definition.Cac
return nil, nil
}
if cache == nil {
return nil, fmt.Errorf("failed to load KeyManager plugin (%s): Cache plugin not configured", cfg.ID)
return nil, model.NewBadReqErr(fmt.Errorf("failed to load KeyManager plugin (%s): Cache plugin not configured", cfg.ID))
}
rClient := client.NewRegisteryClient(&client.Config{RegisteryURL: regURL})
km, err := mgr.KeyManager(ctx, cache, rClient, cfg)
if err != nil {
return nil, fmt.Errorf("failed to load cache plugin (%s): %w", cfg.ID, err)
return nil, model.NewBadReqErr(fmt.Errorf("failed to load cache plugin (%s): %w", cfg.ID, err))
}
log.Debugf(ctx, "Loaded Keymanager plugin: %s", cfg.ID)