~netlandish/gobwebs-graphql

8b41ed575dcd206f05c9de420bacb9e1a924bf71 — Peter Sanchez 3 months ago 2e3216e
Fixing bug where gqlclient.HTTPError's were not processed
1 files changed, 9 insertions(+), 1 deletions(-)

M routes.go
M routes.go => routes.go +9 -1
@@ 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) {