Return codes

What to return from every hook callback.

init

CodeMeaning
0Plugin loaded successfully
non-zeroPlugin load fails; .so is skipped

Lifecycle hooks

ReturnMeaning
HookResult::continue()Run remaining handlers for this event
HookResult::cancel()Stop remaining handlers for this event

config.mutate

CodeMeaning
CONFIG_MUTATE_MODIFIED (0)Output written via write_yaml_output
CONFIG_MUTATE_UNCHANGED (1)Keep prior YAML bytes
negativeError; prior YAML kept

request.intercept / middleware.inject

CodeMeaning
REQUEST_CONTINUE (0)Pass to next hook or HTTP handler
REQUEST_RESPOND (1)Short-circuit; body from write_request_response
negativeError; request continues

route.register

CodeMeaning
ROUTE_OK (0)Response written via write_route_response
negativeHandler error; 500 returned

JSON hooks

CodeMeaning
JSON_MUTATE_MODIFIED (0)Output written via write_json_output
JSON_MUTATE_UNCHANGED (1)Keep prior JSON
negativeError; prior JSON kept

CloudPanel command hooks

CodeMeaning
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
negativeError; current args kept