Discussion about this post

User's avatar
PeterL's avatar

I've seen code like this:

```

def process_file(fname):

try:

f = open(fname, 'rb')

process_opened_file(f)

close(f)

except IOError as e:

print('Could not read file:', fname)

sys.exit()

except:

pass

```

(for the non-technical: this outputs a message if there's a problem opening or reading the file; and silently keeps going for any other exception)

The person who wrote this was lauded for how quickly they cranked out code that (mostly) worked. I was criticized for filing 300 bugs against that code when I had to support it at a customer's site.

[This code doesn't even output what went wrong with opening or reading the file; providing that extra information would take less than 10 more keystrokes]

Expand full comment
Imperceptible Relics's avatar

I am curious if there is an error message that unpacks into like 3 or 4 tiers of error instructions.

Like, "Click here to read error message for end-user: "(e.g. laymen instructions, call this number and mention this error code, or contact the system administrator)"

"Click here to read error message for developer:" "(Boop beep boop beep jargon code)

"Click here to read error message for manager: (type passcode and contact Steve at ext. 211)"

Or "press 1,2, or 3 depending on the user"

Expand full comment
6 more comments...

No posts