Add error checking function for config parser

This commit is contained in:
Mario Hüttel 2020-11-29 19:02:52 +01:00
parent f4d6f5a1ae
commit ed4c18f2be
2 changed files with 13 additions and 0 deletions

View File

@ -188,4 +188,15 @@ enum config_parser_ret config_parser_close_file(config_parser_handle_t handle)
return (res == FR_OK ? CONFIG_PARSER_OK : CONFIG_PARSER_IOERR); return (res == FR_OK ? CONFIG_PARSER_OK : CONFIG_PARSER_IOERR);
} }
bool config_parser_ret_is_abort_condition(enum config_parser_ret return_val)
{
if (return_val == CONFIG_PARSER_END_REACHED ||
return_val == CONFIG_PARSER_GENERIC_ERR ||
return_val == CONFIG_PARSER_IOERR ||
return_val == CONFIG_PARSER_PARAM_ERR)
return true;
return false;
}
/** @} */ /** @} */

View File

@ -90,6 +90,8 @@ enum config_parser_ret config_parser_write_entry(config_parser_handle_t handle,
enum config_parser_ret config_parser_close_file(config_parser_handle_t handle); enum config_parser_ret config_parser_close_file(config_parser_handle_t handle);
bool config_parser_ret_is_abort_condition(enum config_parser_ret return_val);
#endif /* _CONFIG_PARSER_H_ */ #endif /* _CONFIG_PARSER_H_ */
/** @} */ /** @} */