combinedWeaviateError generates an error if err is non-nil or result has errors, and returns an error (or nil if there's no error). It's useful for the results of the Weaviate GraphQL API's "Do" calls.
(result *models.GraphQLResponse, err error)
| 49 | // errors, and returns an error (or nil if there's no error). It's useful for |
| 50 | // the results of the Weaviate GraphQL API's "Do" calls. |
| 51 | func combinedWeaviateError(result *models.GraphQLResponse, err error) error { |
| 52 | if err != nil { |
| 53 | return err |
| 54 | } |
| 55 | if len(result.Errors) != 0 { |
| 56 | var ss []string |
| 57 | for _, e := range result.Errors { |
| 58 | ss = append(ss, e.Message) |
| 59 | } |
| 60 | return fmt.Errorf("weaviate error: %v", ss) |
| 61 | } |
| 62 | return nil |
| 63 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…