Long Error Messages
blog.appsignal.com
blog.appsignal.com
Considering that Apple, with their large market cap and userbase only has a half-assed version of this, I won't get my hopes up.
/s
In my case I had a country name accidentally put in a region field, but it didn't look out of place because field labels are missing when filled in. Frustratingly, your contact card with that address will show a map preview that when tapped opens maps with a pin in the right place, so there's clearly some logic to "fix" incorrect addresses somewhere.
Microsoft does acceptably wel with their 0x80071234, but no parameters, messages like 'installer failed', and googling them gives 10 zillion sites with crap results.
-No performance is wasted in release builds
-Validation checks can be expensive and exhaustive as it will not run in production code
For an average end user...
* If the hard disk is full, that's easy to convey and easy to suggest a fix.
* If a hardware fault occurs on activating a device, suggest they try again and contact support if the problem persists.
* If an unhandled exception occurs, all they need to know is that something very unexpected happened, and they should contact support - they don't need to see a stack trace and error message.
Every time I review error messages, I _always_ ask 3 things:
- What: is the "what" clear.
- Why: explain the reason this happened.
- Next: what can be done next.
Almost all error messages can be expressed this way (the exception being the ones about security where giving information is a way for attackers to more about users, etc.)
The result is great: users almost never ask you any questions, and when they do, it usually means it's either because the message told them to, or because the error message is not clear, and we ensure to clarify it.
Even better would be including the current values of any local variables introduced within the function, and any global variables referenced within the function.
PowerShell's [SecureString] type is something of a step in the right direction, although its execution is lacking in some respects.
In any case, stack traces should _always_ be treated as secrets.
Of course, this is probably only remotely feasible in languages that can guarantee that toString() won't have any side effects.
For a general purpose programming language this means that your toString cannot be a normal function.
But I'm very excited about this upcoming version for a very different reason: they made a huge work on error messages!
Check this out: https://docs.python.org/3.10/whatsnew/3.10.html#better-error...
Syntax errors are more precisely reported, AttributeError/NameError suggest a spelling correction, IndentationError will pinpoint where you screw up...
And yes, a good IDE already does that for you, but a lot of Python dev are using a ligth text editor or just a shell/notebook.
This, to me, is progress! Unsexy, warmly welcome progress.
Helpful, but I can't help but think of Java's syntax errors when you forget a semicolon. If the compiler knows what you meant, then it knows what you meant. That points to the syntax having extra baggage it doesn't really need.
I can tell you 1 + '1' is wrong in python, but can't tell what you meant.
Typo correcting is an excellent example of this. I don't want my program to compile and run if I wrote "taxis" when I meant "taxes". I want an error. Taxis is wrong. But if the diagnostic says "Did you mean taxes?" that's great because it calls attention to the most likely mistake.
I'd say if the machine has a suggestion that it knows would work (but could be wrong) it's better to mention what that suggestion is than keep silent, but it would be worse to just press on as if that's what you wrote.
And soon enough you'll find that it is just more convenient to reuse a few error codes here and there, and soon enough applications just report "error -1: resource failure" or "internal failure" or some other meaningless thing. Far better to just return a string.
> Section: Class 72 - Snapshot Failure > # (class borrowed from Oracle)
Nothing from SAP / ABAP ? :^)
1. Mint a UUID for each specific occurrence of an error the user is getting informed about.
2. Write the whole stacktrace to a log, with the UUID and any other context that seems important.
3. Show the user the UUID, but in smaller type than any advice they might actually be able to use themselves like "0123456789 is not an email address" or "This service is not available to users in your group, juniorAssistants".
4. Ensure front line supports know they need this UUID to pass errors on to anybody who can do more than recite the help text.
Users will take photos of screenshots, they'll attach them to email as Excel spreadsheets with an embedded image, but they can get you the UUID and that shortcuts so much of the debugging process in many cases, while not giving them a bunch of debugging output that:
* Might be non-public by GDPR type rules, legal privilege or just common sense.
* May contain valuable commercial secrets, one man's obvious class hierarchy is another man's secret sauce product design.
* Is long and complicated and will not survive being captured to a screenshot, scaled, pasted into a Word document and then photographed with a phone, which your users actually will do for some reason.