Error Messages Are Classifiers

I found this paper that presents a way to guide error report authoring. What’s your opinion about it? Personally I’m really interested.

https://cs.brown.edu/~sk/Publications/Papers/Published/wk-error-msg-classifier/paper.pdf

6 Likes

Well, while the theoretical part is OK, the practical examples are, euphemistically speaking, suboptimal.

Example:

The binary plus expression failed.
The value of the left side was:
15
The value of the right side was:
“cat”
A binary plus expression expects that either:
• that the left side is a string, or
• that both the left side and right side are numbers.

You already lost your newbie reader after the “The”. Instead of talking about “the binary plus expression” add it to the error message.
The reader has to know what “binary plus expression” means in that context (yes, theoretically it could be a unary +) and way more important: Is the error message talking about a + b, or b + c or c + d or (a + b) + c or … Chances are, the color isn’t displayed in the editor-pop-up or CI-log or… Relying solely on color to be able to know what “left side” and “ride side” is talking about is not a good idea.
At least, when talking about “left side” and “right side” include the contents of them, like:
the left side "a + b", or better, ditch the redundant “left side”.

And add a fix proposal if possible - I don’t care what the literature says about that - LSPs can use these fixes to propose and apply them in the editor. And if your compiler doesn’t support these, the chances that I use your compiler (and language) just got smaller.

‘(a + b) + c’ failed (a binary plus expression).
The value of ‘a + b’ was:
15
The value of ‘c’ was:
“cat”
A binary plus expression expects that either:
• that ‘a + b’ is a string, or
• that both ‘a + b’ and ‘c’ are numbers.
Fix: either:
• change ‘a + b’ to be a string
• change ‘c’ to be a number

2 Likes