-2

Should a short error message be formatted as inline code, bold or simply with double quotes?

Example:

What is the difference between Error: blabla and Error: huhu?

... or ...

What is the difference between Error: blabla and Error: huhu?

... or ...

What is the difference between "Error: blabla" and "Error: huhu"?

3
  • I'd use the quote formatting.
    – Burgi
    Aug 9, 2017 at 17:51
  • 1
    @Burgi Wouldn't it look pretty weird for such a short error message?
    – testeaxeax
    Aug 9, 2017 at 18:01
  • Personally I'd favour the codeblock formatting as it clearly delineates computer input and output. It's largely personal preference though.
    – Mokubai Mod
    Aug 10, 2017 at 7:04

1 Answer 1

4

If the error is mostly human-readable text, I would suggest double quotes. "Error: file not found" looks natural because it's laid out more or less like a standard human sentence. Code formatting should be reserved for (surprise!) code, or things that are generally displayed as monospace, especially if they're not English-like. For example, "ERROR_PRIVILEGE_NOT_HELD" looks ugly to me because normal human text doesn't use underscores and shouty caps, whereas ERROR_PRIVILEGE_NOT_HELD looks fine. Bold has the semantics of emphasis, and so in my opinion shouldn't be used for quoting.

If you have a longer error message, or one that includes quotes, it would be appropriate to use the Markdown quote syntax (start the line with >):

Invalid widget operation "finagle" - expected "frob" or "attune"

However, if the long error message is technical, and especially if it has long lines that would wrap, non-monospaced text is likely to look ugly. In that case, you should use code formatting. Compare this:

finagle : The term 'finagle' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ finagle
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (finagle:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

To this:

finagle : The term 'finagle' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ finagle
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (finagle:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

The former is a mess and definitely shouldn't be used. Outside of situations like that, it can be a matter of personal preference. As long as your question is clear and readable, people probably won't obsess too much over what quoting method you use.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .