Blunder.Absinthe v1.3.0 Blunder.Absinthe View Source

Helpers for Absinthe Integration

Link to this section Summary

Functions

This function takes an Absinthe middleware stack and adds error handling. Each middleware will be wrapped in a &Blunder.trap_exceptions/2 call and Blunder.Absinthe.ErrorProcessingMiddleware appended to the end of the stack to handle those and any other errors

Link to this section Functions

Link to this function add_error_handling(middleware, field, opts \\ []) View Source
add_error_handling(
  [Absinthe.Middleware.spec(), ...],
  any(),
  opts :: [{:timeout_ms, number()}]
) :: [Absinthe.Middleware.spec(), ...]

This function takes an Absinthe middleware stack and adds error handling. Each middleware will be wrapped in a &Blunder.trap_exceptions/2 call and Blunder.Absinthe.ErrorProcessingMiddleware appended to the end of the stack to handle those and any other errors.

Call it in your Schema in your &middleware/3 callback like this:

  def middleware(middleware, field, _object) do
    Blunder.Absinthe.add_error_handling(middleware, field, timeout_ms: 3_000)
  end