Skip to content

User-friendly localizedDescription from query fetch Error #477

@jordanhbuiltbyhq

Description

@jordanhbuiltbyhq

I'm fetching a query in Apollo and the result handler provides an optional result and error object.

apollo.fetch(query: SampleQuery()) { (result, error) in

If the error is non-nil I present this error's localizedDescription to the user (and if it's not then I check if the result's errors is not empty and use the first error's localizedDescription). At times the user can be shown a very unfriendly message from that outer error, such as

Received error response (500 internal server error): {"errors":[{"message":"Context creation failed: Invalid app info headers.","extensions":{"code":"INTERNAL_SERVER_ERROR"}}]}

It seems this is the case when the error is a GraphQLHTTPResponseError. Could we get a friendly localizedDescription out of these errors?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementIssues outlining new things we want to do or things that will make our lives as devs easier

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions