-
Notifications
You must be signed in to change notification settings - Fork 3
Error Handling
Tom Sherman edited this page Mar 8, 2017
·
7 revisions

There are several advantages to calling error or rather THROW_ERROR over using a simple print statement.
- The last error will always be printed, even if the stream crashed due to failed memory allocation.
-
THROW_ERRORallows you to set an error code -
THROW_ERRORautomatically includes file name and line number with the message
THROW_ERROR allows you to send an error code along with the error message. error.h allows for up to 32 unique error codes to be active at the same time. You can check if an error code has been throw with ERROR_THROWN(code). It is recommended you rename error codes to something more specific, i.e.
#define MEM_ALLOC_ERROR ERR_1