Skip to main content

set_error_handler

Function set_error_handler 

Source
pub fn set_error_handler(handler: impl ErrorHandler + 'static)
Expand description

Register a custom ErrorHandler used by all Auth extractors.

Call this once before starting the server, after (or alongside) init_jwt_manager. If never called, the default handler returns empty 401/500 responses.

Panics if called more than once.

§Example

use chopin_auth::extractor::set_error_handler;
set_error_handler(MyJsonErrorHandler);