Timeline for Coding style of critical server's code
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 2, 2014 at 16:47 | comment | added | utnapistim |
@user3275699, you should throw an instance of a class derived from std::exception. I usually use throw std::runtime_error{ "error message here" };.
|
|
| Oct 2, 2014 at 16:41 | history | edited | utnapistim | CC BY-SA 3.0 |
corrected spelling
|
| Oct 2, 2014 at 16:31 | comment | added | Loki Astari | May also want to mention that throwing short distance is not that useful an error code would be just as valid. Exceptions are very useful when crossing interface boundaries and the thrower does not have any knowledge of who would catch. Where the thrower knows who will catch the code is usually more succinctly expressed with error codes. | |
| Oct 2, 2014 at 16:01 | comment | added | Azazel | Thanks for the list of error,just one thing: instead of exit() what should I use? Should I return to the caller function with return ERROR_NUMBER? | |
| Oct 2, 2014 at 15:20 | vote | accept | Azazel | ||
| Oct 2, 2014 at 15:19 | vote | accept | Azazel | ||
| Oct 2, 2014 at 15:20 | |||||
| Oct 2, 2014 at 14:58 | history | answered | utnapistim | CC BY-SA 3.0 |