I'm a beginner, the question might be simple but its really important for me. where does this error codes get store?? How to make use of err_code and whats the best way to debug my application?
I'm a beginner, the question might be simple but its really important for me. where does this error codes get store?? How to make use of err_code and whats the best way to debug my application?
One way to use the err_code is to define DEBUG globally, like shown in the image, and hence use APP_ERROR_CHECK(err_code);
to assert the error code. This way, if you get an error, you will end up in a while forever loop in app_error_handler()
(defined in app_error.c) and you can find out in which file and line number your error occurred using the debugger.
One way to use the err_code is to define DEBUG globally, like shown in the image, and hence use APP_ERROR_CHECK(err_code);
to assert the error code. This way, if you get an error, you will end up in a while forever loop in app_error_handler()
(defined in app_error.c) and you can find out in which file and line number your error occurred using the debugger.
Thanks Martin for your help.
I wanted to add that I supplied my own app_error_handler and could not get line number & filename without the DEBUG preprocessor directive. Hope this helps someone in the future.