File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed
Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 1515package resources
1616
1717import (
18+ "errors"
1819 "sync"
1920
2021 "github.com/googleapis/genai-toolbox/internal/auth"
@@ -142,12 +143,15 @@ func (r *ResourceManager) Close() error {
142143 r .mu .Lock ()
143144 defer r .mu .Unlock ()
144145
146+ var errs []error
145147 for _ , source := range r .sources {
146148 if closeable , ok := source .(sources.CloseableSource ); ok {
147- _ = closeable .Close ()
149+ if err := closeable .Close (); err != nil {
150+ errs = append (errs , err )
151+ }
148152 }
149153 }
150- return nil
154+ return errors . Join ( errs ... )
151155}
152156
153157func (r * ResourceManager ) GetEmbeddingModelMap () map [string ]embeddingmodels.EmbeddingModel {
Original file line number Diff line number Diff line change @@ -313,8 +313,9 @@ func (s *Source) ToConfig() sources.SourceConfig {
313313
314314// Close closes the BigQuery source and its associated caches/clients.
315315func (s * Source ) Close () error {
316+ var err error
316317 if s .Client != nil {
317- s .Client .Close ()
318+ err = s .Client .Close ()
318319 }
319320 if s .bqClientCache != nil {
320321 s .bqClientCache .Stop ()
@@ -325,7 +326,7 @@ func (s *Source) Close() error {
325326 if s .dataplexCache != nil {
326327 s .dataplexCache .Stop ()
327328 }
328- return nil
329+ return err
329330}
330331
331332func (s * Source ) BigQueryClient () * bigqueryapi.Client {
Original file line number Diff line number Diff line change @@ -124,13 +124,14 @@ func (s *Source) ToConfig() sources.SourceConfig {
124124
125125// Close closes the Cloud Logging Admin source and its associated caches/clients.
126126func (s * Source ) Close () error {
127+ var err error
127128 if s .Client != nil {
128- s .Client .Close ()
129+ err = s .Client .Close ()
129130 }
130131 if s .logadminClientCache != nil {
131132 s .logadminClientCache .Stop ()
132133 }
133- return nil
134+ return err
134135}
135136
136137func (s * Source ) UseClientAuthorization () bool {
You can’t perform that action at this time.
0 commit comments