Click here to Skip to main content
15,881,248 members
Articles / Operating Systems / Windows
Technical Blog

Friendly Error Messages

Rate me:
Please Sign up or sign in to vote.
1.00/5 (2 votes)
3 Jul 2013Apache1 min read 7.2K   1   3
I would rather have the message honestly tell me what happened, and only then elaborate on a list of typical reasons.

I just accidently gave .EXE extension to a file that was actually a .ZIP archive and tried to run it on Windows 7. What error do I get? Lo and behold:

The version of this file is not compatible with the version of Windows you’re running. Check your computer’s system information to see whether you need an x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.

Needless to say, this “program” won’t run on 32-bit, 64-bit or even 56-bit Windows. Because it is not a program at all, it’s a ZIP archive. The error message sent me searching in a completely wrong direction.

I would rather have the message honestly tell me what happened (invalid executable format), and only then elaborate on a list of typical reasons for this debacle. I wonder what is the error message in Windows 8.1 (note to self: download it from MSDN).

This reminds me of the days when ERROR_NOT_SUPPORTED came out with the text like “This call is not implemented on Windows 95, it only works on Windows NT”, which looked especially funny when you were running NT.

PS. It is even funnier on 32-bit windows. Check it out, it interprets misnamed EXE as a COM file and actually starts to execute it! If it is less than 64K in size of course. Otherwise you get “program too big to fit in memory” error, but only when running it from cmd.exe. Things we do for backward compatibility…

This article was originally posted at http://www.ikriv.com/blog?p=1320

License

This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0


Written By
Technical Lead Thomson Reuters
United States United States
Ivan is a hands-on software architect/technical lead working for Thomson Reuters in the New York City area. At present I am mostly building complex multi-threaded WPF application for the financial sector, but I am also interested in cloud computing, web development, mobile development, etc.

Please visit my web site: www.ikriv.com.

Comments and Discussions

 
GeneralMy vote of 1 Pin
SteveKing3-Jul-13 21:22
SteveKing3-Jul-13 21:22 
GeneralRe: My vote of 1 Pin
Ivan Krivyakov4-Jul-13 5:44
Ivan Krivyakov4-Jul-13 5:44 
This was a blog entry, not an article. Unfortunately, CodeProject does not clearly distinguish between the two.

First useful point is for me to record what that error message actually means.

Second, more philosophical point is that it's a bad idea for an error message to enumerate possible root causes without clearly saying what actually happened ("invalid executable format" in this case). This is bound to become misleading if the real root cause is not the one the authors expected. I did not propose exact text, but I did try to convey this idea; probably it did not come out very clearly.
GeneralMy vote of 1 Pin
nobodyxxxxx3-Jul-13 3:19
nobodyxxxxx3-Jul-13 3:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.