In my project, I'm setting up an error handling system, but before I put in the code, I setup a test project to get a foundation to build off of. I have everything I need, except for one thing, which is the error.ToMessage() function. Problem is, I don't know how to set up the function in the way I have built it and can't find examples.
Here is my code:
#include <iostrea> enum class ErrorCode { StreamError, FileError, CloseError }; int main() { try { throw ErrorCode::StreamError } catch (ErrorCode err) { //std::cout << err.ToMessage() << std::endl; //This is how I would like to output the error. switch (err) { case ErrorCode::StreamError: std::cout << "Stream Error"; //This is how it's currently done. //... } } } How can I do this, if it's possible?