From c93ccc6eb77a08446c25a6339e96147237576a74 Mon Sep 17 00:00:00 2001 From: Jared O'Connell Date: Wed, 8 Nov 2023 19:04:13 -0500 Subject: [PATCH 1/2] Only report error when error is present --- internal/step/plugin/provider.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/step/plugin/provider.go b/internal/step/plugin/provider.go index 29a21e1d..f53d9bb5 100644 --- a/internal/step/plugin/provider.go +++ b/internal/step/plugin/provider.go @@ -270,8 +270,13 @@ func (p *pluginProvider) LoadSchema(inputs map[string]any, _ map[string][]byte) cancel() // Close it. This allows it go get the error messages. deployerErr := pluginConnector.Close() - return nil, fmt.Errorf("failed to read plugin schema from '%s' (%w). Deployer close error: (%s)", - pluginSource, err, deployerErr.Error()) + if deployerErr == nil { + return nil, fmt.Errorf("failed to read plugin schema from '%s' (%w)", + pluginSource, err) + } else { + return nil, fmt.Errorf("failed to read plugin schema from '%s' (%w). Deployer close error: (%s)", + pluginSource, err, deployerErr.Error()) + } } // Tell the server that the client is done if err := transport.Close(); err != nil { From a306158a8b9b93431fb025193768ed3db2964039 Mon Sep 17 00:00:00 2001 From: Jared O'Connell Date: Wed, 8 Nov 2023 19:10:27 -0500 Subject: [PATCH 2/2] Make picky CI happy --- internal/step/plugin/provider.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/step/plugin/provider.go b/internal/step/plugin/provider.go index f53d9bb5..6003cdf8 100644 --- a/internal/step/plugin/provider.go +++ b/internal/step/plugin/provider.go @@ -270,13 +270,12 @@ func (p *pluginProvider) LoadSchema(inputs map[string]any, _ map[string][]byte) cancel() // Close it. This allows it go get the error messages. deployerErr := pluginConnector.Close() - if deployerErr == nil { - return nil, fmt.Errorf("failed to read plugin schema from '%s' (%w)", - pluginSource, err) - } else { + if deployerErr != nil { return nil, fmt.Errorf("failed to read plugin schema from '%s' (%w). Deployer close error: (%s)", pluginSource, err, deployerErr.Error()) } + return nil, fmt.Errorf("failed to read plugin schema from '%s' (%w)", + pluginSource, err) } // Tell the server that the client is done if err := transport.Close(); err != nil {