(w http.ResponseWriter)
| 2257 | } |
| 2258 | |
| 2259 | func (e gqlError) WriteTo(w http.ResponseWriter) { |
| 2260 | gqlerr := &gqlerror.Error{ |
| 2261 | Err: e.error, |
| 2262 | Message: e.Error(), |
| 2263 | } |
| 2264 | res := graphql.Response{ |
| 2265 | Errors: gqlerror.List{gqlerr}, |
| 2266 | } |
| 2267 | bytes, err := json.Marshal(res) |
| 2268 | if err != nil { |
| 2269 | panic(err) |
| 2270 | } |
| 2271 | http.Error(w, string(bytes), e.httpCode) |
| 2272 | } |
| 2273 | |
| 2274 | // httpHandlerFunc lets you write an http handler that just returns an error, which will be |
| 2275 | // turned into a 500 http response if non-nil, or a specific code if the error is of type httpError. |
no test coverage detected