HookConfig#

class brainstate.HookConfig(on_error='log', error_logger=None, max_errors_per_hook=10, disable_on_error=False)[source]#

Configuration for hook error handling and behavior.

on_error#

How to handle hook execution errors: - ‘raise’: Propagate the exception to the caller - ‘log’: Log the error and continue (default) - ‘ignore’: Silently ignore errors

Type:

Literal['raise', 'log', 'ignore']

error_logger#

Optional custom error logging function

Type:

Callable[[str, Exception, Hook, HookContext], None] | None

max_errors_per_hook#

Maximum errors before auto-disabling (default 10)

Type:

int

disable_on_error#

Whether to auto-disable hooks after max errors (default False)

Type:

bool