Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

When I have a question that displays an error message from somewhere, is it better to place that error message inside a code markup block or a quote markup block?

It seems like more people are doing it with code markup blocks, but that doesn't really make sense as error messages are not code; rather, they are quotes from whatever entity generated the message.

share|improve this question
Note that in a quote you'd need to manually escape any < (and >) character. – Arjan Jan 26 '13 at 15:16
and # @Arjan; you get random headings otherwise. – ben is uǝq backwards Jan 26 '13 at 15:23
up vote 11 down vote accepted

It has nothing to do with whether the error is code or not. You should use the option which renders the error message in the most readable manner. For me, this has normally been as quoted text rather than code but that is not true for every situation.

For instance, if we take this Java exception marked up as code it looks like this:

Exception in thread "main" java.lang.NullPointerException
    at javax.swing.ImageIcon.<init>(Unknown Source)
    at Intro.<init>(
    at Intro.main(    

and as a quote like this:

Exception in thread "main" java.lang.NullPointerException at javax.swing.ImageIcon.(Unknown Source) at Intro.( at Intro.main(

The quote does not look good.

However, looking at this Oracle error marked up as code

ERROR at line 1: ORA-01400: cannot insert NULL into ("SCHEMA"."TMP_BEN_TEST"."A") ORA-02063: preceding line from DB1 ORA-06512: at line 18

It is more difficult to read; far better as a quote:

ERROR at line 1: ORA-01400: cannot insert NULL into ("SCHEMA"."TMP_BEN_TEST"."A") ORA-02063: preceding line from DB1 ORA-06512: at line 18

share|improve this answer
As an aside: note the different rendering on mobile (code blocks never show scrollbars: they are not limited in height, and have no horizontal scrollbars but wrap text instead). But long stack traces should be avoided anyhow. – Arjan Jan 26 '13 at 15:34
I also wonder if screen readers might somehow interpret code blocks differently from quotes? – Arjan Jan 26 '13 at 15:42
I've been trying to find a particularly egregious example I remember of the long stack trace art (about 150 lines long and that was the entire question) but I have a feeling I only saw it whilst voting to delete... I honestly have no idea how a screen reader might see it. You could ask the question :-). – ben is uǝq backwards Jan 26 '13 at 15:48

I'd put it in a code block, but use none as the language to avoid funky syntax highlighting that usually just doesn't make sense:

<!-- language: none -->

    This is the error that isn't code but isn't a quotation
share|improve this answer

You must log in to answer this question.

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