dixx / Die_Chroniken_eines_namenlosen_Spiels

We develop a game just for the sake of learning how to do it. Okay, maybe it's more developing a game engine and using a game as its integration test. We have no real goal besides the learning experience.
Other
1 stars 1 forks source link

add error handling #109

Closed dixx closed 5 years ago

dixx commented 5 years ago

Not only do we need to log errors, we also need to set an errorlevel / exit code. May be done via Logger or an extra class.

Goal: Use default objects where feasible, catch exceptions where they can be handled, log every exceptional behavior, and always shut down gracefully.

dixx commented 5 years ago

Seems we may use exit codes -1 < code < 256, where 0 means success and all other mean failure.

dixx commented 5 years ago

We cannot exit() far away from main, as no stack unwinding will happen then --> memory leaks. So either we unwind from hand, or via exception caught in main, which is a bad thing to do.

dixx commented 5 years ago

Good read about exceptions: https://isocpp.org/wiki/faq/exceptions http://www.modernescpp.com/index.php/c-core-guidelines-rules-to-error-handling https://docs.microsoft.com/en-us/cpp/cpp/how-to-design-for-exception-safety?view=vs-2017 https://dzone.com/articles/some-useful-facts-to-know-when-using-c-exceptions

dixx commented 5 years ago

Blocker: #111

dixx commented 5 years ago

PR: https://github.com/dixx/Die_Chroniken_eines_namenlosen_Spiels/pull/116