The Common application error handler module provides the weak function app_error_fault_handler for handling application and SoftDevice errors. If custom handing of errors is needed, app_error_fault_handler can be redefined in the application. Most example applications in the SDK use the default function.
The app_error_fault_handler has the same signature as the nrf_fault_handler_t. The error module defines its own IDs (Fault ID types) in addition to the ones defined by the SoftDevice (Fault ID types). In some cases (see the ID documentation), the uint32_t info parameter represents a pointer to a struct that has been cast.
The behavior of the default error handler depends on whether the DEBUG flag is set:
If the DEBUG flag is not set:
When app_error_fault_handler is invoked, the MCU is reset.
If the DEBUG flag is set:
When app_error_fault_handler is invoked, the error info (for example the function parameters: error code, line number, and file name) are copied to global memory, interrupts are disabled, and the application enters an infinite loop.
If the BSP_DEFINES_ONLY flag is set, all LEDs available on the board are turned on.
If the BSP_DEFINES_ONLY flag is not set, the BSP_INDICATE_FATAL_ERROR state is indicated.