Handling unknown crashes/errors/exceptions in Absinthe

How can we handle unexcepted exceptions/errors/crashes in Absinthe?

For example, let’s say something unexpected happens(pattern matching fails etc.), or a process crashes…
When I run a query in graphiql, when something like the above happens Absinthe/Phx returns an HTML response which is not valid for GraphQL spec.

What is the best way to deal with this and return proper JSON error payload to graphql client

For anyone who is looking for answer, this worked for me

This doesnt cover crashes in DataLoader etc