diff --git a/cli/migrate/database/hasuradb/hasuradb.go b/cli/migrate/database/hasuradb/hasuradb.go index f2ee7ef8992..8389fece410 100644 --- a/cli/migrate/database/hasuradb/hasuradb.go +++ b/cli/migrate/database/hasuradb/hasuradb.go @@ -186,7 +186,7 @@ func (h *HasuraDB) UnLock() error { if resp.StatusCode != http.StatusOK { err = json.Unmarshal(body, &horror) if err != nil { - return err + return fmt.Errorf("failed parsing json: %v; response from API: %s", err, string(body)) } // Handle migration version here @@ -308,7 +308,7 @@ func (h *HasuraDB) getVersions() (err error) { if resp.StatusCode != http.StatusOK { err = json.Unmarshal(body, &horror) if err != nil { - return err + return fmt.Errorf("failed parsing json: %v; response from API: %s", err, string(body)) } return horror.Error(h.config.isCMD) @@ -393,7 +393,7 @@ func (h *HasuraDB) Reset() error { if resp.StatusCode != http.StatusOK { err = json.Unmarshal(body, &horror) if err != nil { - return err + return fmt.Errorf("failed parsing json: %v; response from API: %s", err, string(body)) } return horror.Error(h.config.isCMD) @@ -428,7 +428,7 @@ func (h *HasuraDB) ensureVersionTable() error { err = json.Unmarshal(body, &horror) if err != nil { h.logger.Debug(err) - return err + return fmt.Errorf("failed parsing json: %v; response from API: %s", err, string(body)) } return horror.Error(h.config.isCMD) } @@ -465,7 +465,7 @@ func (h *HasuraDB) ensureVersionTable() error { if resp.StatusCode != http.StatusOK { err = json.Unmarshal(body, &horror) if err != nil { - return err + return fmt.Errorf("failed parsing json: %v; response from API: %s", err, string(body)) } return horror.Error(h.config.isCMD) diff --git a/cli/migrate/database/hasuradb/metadata.go b/cli/migrate/database/hasuradb/metadata.go index 54ee5d13cd1..14d48d1182b 100644 --- a/cli/migrate/database/hasuradb/metadata.go +++ b/cli/migrate/database/hasuradb/metadata.go @@ -2,6 +2,7 @@ package hasuradb import ( "encoding/json" + "fmt" "net/http" "github.com/hasura/graphql-engine/cli/migrate/database" @@ -28,7 +29,7 @@ func (h *HasuraDB) ExportMetadata() (interface{}, error) { err = json.Unmarshal(body, &horror) if err != nil { h.logger.Debug(err) - return nil, err + return nil, fmt.Errorf("failed parsing json: %v; response from API: %s", err, string(body)) } return nil, horror.Error(h.config.isCMD) } @@ -60,7 +61,7 @@ func (h *HasuraDB) ResetMetadata() error { err = json.Unmarshal(body, &horror) if err != nil { h.logger.Debug(err) - return err + return fmt.Errorf("failed parsing json: %v; response from API: %s", err, string(body)) } return horror.Error(h.config.isCMD) } @@ -86,7 +87,7 @@ func (h *HasuraDB) ReloadMetadata() error { err = json.Unmarshal(body, &horror) if err != nil { h.logger.Debug(err) - return err + return fmt.Errorf("failed parsing json: %v; response from API: %s", err, string(body)) } return horror.Error(h.config.isCMD) } @@ -180,7 +181,7 @@ func (h *HasuraDB) ApplyMetadata(data interface{}) error { err = json.Unmarshal(body, &horror) if err != nil { h.logger.Debug(err) - return err + return fmt.Errorf("failed parsing json: %v; response from API: %s", err, string(body)) } if horror.Path != "" { @@ -225,7 +226,7 @@ func (h *HasuraDB) Query(data []interface{}) error { err = json.Unmarshal(body, &horror) if err != nil { h.logger.Debug(err) - return err + return fmt.Errorf("failed parsing json: %v; response from API: %s", err, string(body)) } return horror.Error(h.config.isCMD) } diff --git a/cli/migrate/database/hasuradb/settings.go b/cli/migrate/database/hasuradb/settings.go index 12c7e738ec1..2596e4184fe 100644 --- a/cli/migrate/database/hasuradb/settings.go +++ b/cli/migrate/database/hasuradb/settings.go @@ -31,7 +31,7 @@ func (h *HasuraDB) ensureSettingsTable() error { err = json.Unmarshal(body, &horror) if err != nil { h.logger.Debug(err) - return err + return fmt.Errorf("failed parsing json: %v; response from API: %s", err, string(body)) } return horror.Error(h.config.isCMD) } @@ -69,7 +69,7 @@ func (h *HasuraDB) ensureSettingsTable() error { if resp.StatusCode != http.StatusOK { err = json.Unmarshal(body, &horror) if err != nil { - return err + return fmt.Errorf("failed parsing json: %v; response from API: %s", err, string(body)) } return horror.Error(h.config.isCMD) @@ -115,7 +115,7 @@ func (h *HasuraDB) setDefaultSettings() error { err = json.Unmarshal(body, &horror) if err != nil { h.logger.Debug(err) - return err + return fmt.Errorf("failed parsing json: %v; response from API: %s", err, string(body)) } return horror.Error(h.config.isCMD) } @@ -144,7 +144,7 @@ func (h *HasuraDB) GetSetting(name string) (value string, err error) { if resp.StatusCode != http.StatusOK { err = json.Unmarshal(body, &horror) if err != nil { - return value, err + return value, fmt.Errorf("failed parsing json: %v; response from API: %s", err, string(body)) } return value, horror.Error(h.config.isCMD) @@ -193,7 +193,7 @@ func (h *HasuraDB) UpdateSetting(name string, value string) error { if resp.StatusCode != http.StatusOK { err = json.Unmarshal(body, &horror) if err != nil { - return err + return fmt.Errorf("failed parsing json: %v; response from API: %s", err, string(body)) } return horror.Error(h.config.isCMD)