Module restia.handler
Loads configurations from files on demand.
Info:
- License: Unlicense
- Author: DarkWiiPlayer
Functions
xpcall (action, handler) | Similar to Luas xpcall, but exits the nginx request in case of error. |
serve (handlermodule[, errormodule="error"][, action], ...) | Serves a handler. |
Local Functions
exit_on_failure (success, ...) | Handles the result of xpcall. |
Functions
- xpcall (action, handler)
-
Similar to Luas xpcall, but exits the nginx request in case of error.
A custom message handler takes care of logging and rendering an error message.
This function is still very much work in progress and its behavior may change.
Parameters:
- action function The code that should run in “protected” mode to handle the request (a module name).
- handler function The error handler, which may return a HTTP error code.
Returns:
-
The return value of the action function.
- serve (handlermodule[, errormodule="error"][, action], ...)
-
Serves a handler. This is a higher-level wrapper to handler.xpcall that requires a module.
If no
action
is given, the module is assumed to return a handler function directly. If theaction
is given, the module is treated as a table and deep-indexed withaction
to get the handler function.Parameters: