feat(storage): improve storage connectivity error handling and multi-instance support
Enhance error messaging for storage connectivity issues by sanitizing raw errors to prevent leaking sensitive information. Introduce a new utility function for consistent error handling across storage backend operations. Additionally, implement logic to support multi-instance storage backends, allowing for more flexible workspace configurations and improved reporting of active storage providers.
This commit is contained in:
@@ -35,7 +35,7 @@ func (s *StorageBackendService) Create(ctx context.Context, backend *types.Stora
|
||||
return err
|
||||
}
|
||||
if err := s.Test(ctx, backend); err != nil {
|
||||
return apperrors.NewBadRequestError("storage connection test failed").WithDetails(err.Error())
|
||||
return apperrors.NewBadRequestError("storage connection test failed").WithDetails(secutils.SanitizeStorageConnectivityError(err))
|
||||
}
|
||||
backend.CreatedAt, backend.UpdatedAt = time.Now(), time.Now()
|
||||
if err := s.repo.Create(ctx, backend); err != nil {
|
||||
@@ -87,7 +87,7 @@ func (s *StorageBackendService) Update(ctx context.Context, incoming *types.Stor
|
||||
return err
|
||||
}
|
||||
if err := s.Test(ctx, incoming); err != nil {
|
||||
return apperrors.NewBadRequestError("storage connection test failed").WithDetails(err.Error())
|
||||
return apperrors.NewBadRequestError("storage connection test failed").WithDetails(secutils.SanitizeStorageConnectivityError(err))
|
||||
}
|
||||
incoming.UpdatedAt = time.Now()
|
||||
return s.repo.Update(ctx, incoming)
|
||||
|
||||
Reference in New Issue
Block a user