From 8b41ed575dcd206f05c9de420bacb9e1a924bf71 Mon Sep 17 00:00:00 2001 From: Peter Sanchez Date: Wed, 14 Aug 2024 18:46:13 -0600 Subject: [PATCH] Fixing bug where gqlclient.HTTPError's were not processed --- routes.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/routes.go b/routes.go index 657691b..a94594a 100644 --- a/routes.go +++ b/routes.go @@ -132,7 +132,15 @@ func (s *Service) GQLPlayground(c echo.Context) error { op := gqlclient.NewOperation(form.Query) err := s.execute(c.Request().Context(), op, &result) if err != nil { - if graphError, ok := err.(*gqlclient.Error); ok { + switch err.(type) { + case *gqlclient.HTTPError: + graphError := err.(*gqlclient.HTTPError) + inputErrs := validate.NewInputErrors() + inputErrs["_global_"] = []string{graphError.Error()} + gmap["errors"] = inputErrs + return s.Render(c, http.StatusOK, "graphql.html", gmap) + case *gqlclient.Error: + graphError := err.(*gqlclient.Error) gmap["form"] = form err = s.parse(c, graphError, gobwebs.Map{}) switch err.(type) { -- 2.45.2