Return codes
What to return from every hook callback.
init
| Code | Meaning |
0 | Plugin loaded successfully |
| non-zero | Plugin load fails; .so is skipped |
Lifecycle hooks
| Return | Meaning |
HookResult::continue() | Run remaining handlers for this event |
HookResult::cancel() | Stop remaining handlers for this event |
config.mutate
| Code | Meaning |
CONFIG_MUTATE_MODIFIED (0) | Output written via write_yaml_output |
CONFIG_MUTATE_UNCHANGED (1) | Keep prior YAML bytes |
| negative | Error; prior YAML kept |
request.intercept / middleware.inject
| Code | Meaning |
REQUEST_CONTINUE (0) | Pass to next hook or HTTP handler |
REQUEST_RESPOND (1) | Short-circuit; body from write_request_response |
| negative | Error; request continues |
route.register
| Code | Meaning |
ROUTE_OK (0) | Response written via write_route_response |
| negative | Handler error; 500 returned |
JSON hooks
| Code | Meaning |
JSON_MUTATE_MODIFIED (0) | Output written via write_json_output |
JSON_MUTATE_UNCHANGED (1) | Keep prior JSON |
| negative | Error; prior JSON kept |
CloudPanel command hooks
| Code | Meaning |
CLOUDPANEL_CONTINUE (0) | Keep current CLI args and continue |
CLOUDPANEL_MODIFIED (1) | Output written via write_cloudpanel_args |
CLOUDPANEL_CANCEL (2) | Cancel the command; optional reason from write_cloudpanel_cancel |
| negative | Error; current args kept |