增加事件驱动和业务回滚处理方式
This commit is contained in:
49
app/error_handler.h
Normal file
49
app/error_handler.h
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* error_handler.h
|
||||
*
|
||||
* Created on: 2026-03-04
|
||||
* Author: RT-Thread
|
||||
*
|
||||
* 功能: 错误处理与恢复模块头文件
|
||||
* 依赖: RT-Thread Nano, osal, transaction, state_manager
|
||||
* 跨平台适配: 基于RT-Thread Nano,使用标准API
|
||||
*/
|
||||
|
||||
#ifndef ERROR_HANDLER_H
|
||||
#define ERROR_HANDLER_H
|
||||
|
||||
#include <rtthread.h>
|
||||
#include "osal.h"
|
||||
#include "state_manager.h"
|
||||
|
||||
/**
|
||||
* @brief 初始化错误处理器
|
||||
* @return 0 成功,非0 失败
|
||||
*/
|
||||
int error_handler_init(void);
|
||||
|
||||
/**
|
||||
* @brief 处理错误
|
||||
* @param error 错误代码
|
||||
* @param user_data 用户数据
|
||||
* @return 0 成功,非0 失败
|
||||
*/
|
||||
int error_handler_process(error_code_t error, void *user_data);
|
||||
|
||||
/**
|
||||
* @brief 记录错误日志
|
||||
* @param error 错误代码
|
||||
* @param message 错误信息
|
||||
* @return 0 成功,非0 失败
|
||||
*/
|
||||
int error_handler_log(error_code_t error, const char *message);
|
||||
|
||||
/**
|
||||
* @brief 触发错误报警
|
||||
* @param error 错误代码
|
||||
* @param message 错误信息
|
||||
* @return 0 成功,非0 失败
|
||||
*/
|
||||
int error_handler_alert(error_code_t error, const char *message);
|
||||
|
||||
#endif /* ERROR_HANDLER_H */
|
||||
Reference in New Issue
Block a user