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.