View Source Antikythera.GearApplication.ErrorHandler (antikythera v0.5.1)

Helper module for gear's custom error handler.

To customize HTTP responses returned on errors, gear must implement an error handler module which

  • is named YourGear.Controller.Error, and
  • defines the following functions:
    • Mandatory error handlers
      • error(Antikythera.Conn.t, Antikythera.ErrorReason.gear_action_error_reason) :: Antikythera.Conn.t
      • no_route(Antikythera.Conn.t) :: Antikythera.Conn.t
      • bad_request(Antikythera.Conn.t) :: Antikythera.Conn.t
    • Optional error handlers
      • bad_executor_pool_id(Antikythera.Conn.t, Antikythera.ExecutorPool.BadIdReason.t) :: Antikythera.Conn.t
      • ws_too_many_connections(Antikythera.Conn.t) :: Antikythera.Conn.t (when your gear uses websocket)

This module generates YourGear.error_handler_module/0 function, which is called by antikythera when handling errors.