Skip to content

Commit

Permalink
remove redundant error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispatrick committed Feb 5, 2024
1 parent 977c5ca commit 3fa77f4
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions policy/data/gql_async.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import (
b64 "encoding/base64"
"encoding/json"
"fmt"
"github.com/atomist-skills/go-skill/policy/goals"
"io"
"net/http"
"strings"

"github.com/atomist-skills/go-skill/policy/goals"

"github.com/atomist-skills/go-skill"
"olympos.io/encoding/edn"
)
Expand Down Expand Up @@ -69,13 +70,6 @@ func NewAsyncDataSource(
}

func (ds AsyncDataSource) Query(ctx context.Context, queryName string, query string, variables map[string]interface{}, output interface{}) (*QueryResponse, error) {
if existingResult, ok := ds.asyncResults[queryName]; ok {
if len(existingResult.Errors) != 0 {
return nil, fmt.Errorf("async query returned error: %s", existingResult.Errors[0].Message)
}
return &QueryResponse{}, edn.Unmarshal(existingResult.Data, output)
}

if len(ds.asyncResults) > 0 && !ds.multipleQuerySupport {
ds.log.Debugf("skipping async query for query %s due to lack of multipleQuerySupport", queryName)
return nil, nil // don't error, in case there is another applicable query executor down-chain
Expand Down

0 comments on commit 3fa77f4

Please sign in to comment.