Skip to content

Commit e2cf374

Browse files
skevytimsuchanek
authored andcommitted
Output 'result' from apollo-link-http error (#755)
1 parent c4d0371 commit e2cf374

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/graphql-playground-react/src/state/sessions/fetchingSagas.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,11 @@ export function formatError(error, fetchingSchema: boolean = false) {
237237

238238
function extractMessage(error) {
239239
if (error instanceof Error) {
240+
// Errors from apollo-link-http may include a "result" object, which is a JSON response from
241+
// the server. We should surface that to the client
242+
if (!!error['result'] && typeof error['result'] === 'object') {
243+
return (error as any).result
244+
}
240245
return error.message
241246
}
242247

0 commit comments

Comments
 (0)