#57 Check return codes everywhere

open-later
nobody
None
5
2009-11-01
2009-10-28
Markus Elfring
No

Some checks for return codes are missing.

Examples:
Would you like to add more error handling for return values from "SetWindowsHookEx" like in the function "CDjViewApp::DoMessageBox" and from "GetModuleFileName" in the function "CDjViewApp::RegisterShellFileTypes"?
http://windjview.cvs.sourceforge.net/viewvc/windjview/windjview/WinDjView.cpp?revision=1.124&view=markup

Discussion

  • I agree that many error checks are missing in the code, however properly checking every Windows API call for errors would be extremely tedious, and in the majority of cases this will be just a waste of time. There have been no reported bugs so far with the functions you mentioned. So unless the omitted checks cause actual problems, I will not add any extra handling of return codes.

     
    • status: open --> open-wont-fix
     
    • status: open-wont-fix --> pending-wont-fix
     
  • Markus Elfring
    Markus Elfring
    2009-11-01

    You do not need to make assumptions about error situations. Please check all error codes.
    Otherwise, it might not be noticed if anything unexpected went wrong.

    I suggest to avoid unchecked function calls.
    Would you like to detect every error situation as early as possible?

    Would you like to reduce the efforts for error code checking by an exception class hierarchy?
    http://dietmar-kuehl.de/mirror/c++-faq/exceptions.html#faq-17.1
    http://cexcept.sourceforge.net/

     
  • Markus Elfring
    Markus Elfring
    2009-11-01

    • status: pending-wont-fix --> open-later