16

There are still many questions with code or error messages posted as screenshot only, despite the discouraging message in the image uploader for low-rep users (see the accepted answer to Discourage screenshots of code and/or errors).

I think it would be useful to have an entry in the Asking section of the Help Center explaining how to post code or error messages.

The main advantage would be the possibility to simply post a comment with a link to this new Help Center entry in order to tell the OP how to improve the post when one encounters a question with code or error messages posted as screenshot only (as already possible e.g. for requesting a Minimal, Complete, and Verifiable example). The new entry itself would also hopefully help reducing the number of such questions.

This new entry could look like this:

How to post code or error messages

Don't post images of code or error messages. Instead copy and paste or type the actual code/message into the post directly.

Indent code by 4 spaces to format as a code block.

Add a > to the beginning of an error message to format as blockquotes or indent by 4 spaces to format as a code block, depending on what seems appropriate.

15
  • 14
    The majority of unformatted code comes from new users, and the majority of new users don't read the help centre. So yes it could be added to the help centre for the how to ask page but I feel it would be superfluous Commented Sep 14, 2018 at 6:21
  • 4
    Also, many times error messages are better posted inside a blockquote instead of a code block, IMO. They do not get any superfluous highlighting and text gets wrapped. So I do not think a guidance to always "post error messages as code blocks" is all that great.
    – yivi
    Commented Sep 14, 2018 at 6:42
  • 2
    @WhatsThePoint My point is actually mainly the possibility to simply link to the new Help Center entry in order to tell how to improve the post. I've edited my proposal accordingly.
    – jpeg
    Commented Sep 14, 2018 at 6:42
  • 3
    @jpeg so you are wanting something similar to Markdown Editing help page? Commented Sep 14, 2018 at 6:48
  • @yivi Good point, thank you. Edited the proposal accordingly.
    – jpeg
    Commented Sep 14, 2018 at 6:54
  • 1
    @WhatsThePoint Thank you for the link to the Markdown Editing help page which I didn't know (thus haven't read, fulfilling your prophecy about new users...). Integrated in my proposal.
    – jpeg
    Commented Sep 14, 2018 at 6:56
  • @jpeg, in the answer box below Click on the grey quuestion mark on the left top corner. you will have most of the feature here. And from there the Advanced thing link to the Markdown edit page. Commented Sep 14, 2018 at 7:45
  • It the same in Question box, but answer box is closer to check the existing feature. Commented Sep 14, 2018 at 7:47
  • @DragandDrop I know this feature, it is not what I'm requesting. I wish an easy-to-link summary of how to post code or error messages.
    – jpeg
    Commented Sep 14, 2018 at 7:53
  • 1
    Related: Modify the [MCVE] page to emphasize [edit]-ing question body. Commented Sep 14, 2018 at 12:14
  • 2
    feel free to steal idownvotedbecau.se/imageofanexception
    – user1228
    Commented Sep 14, 2018 at 18:19
  • 2
    @yivi: Text wrapping is a very bad thing for stack traces and many other categories of error message, and quote-formatting also obscures exact spacing details within a line that can be crucial for debugging. Also, if code-formatting turns out to be bad for a particular error message, it's easy to convert to quote-formatting. If quote-formatting turns out to be a bad idea, the quote-format button has already destroyed the original spacing and line break information; it cannot be recovered without access to the original source of the error. Commented Sep 14, 2018 at 19:21
  • @user2357112 Good thing I said "many times" and not "always" then.
    – yivi
    Commented Sep 14, 2018 at 19:22
  • 1
    @yivi: It's almost impossible to know whether the information destroyed by quote-formatting is important unless you have a good understanding of what caused the error, though, and people who understand what went wrong usually don't need to post a Stack Overflow question about their problem. It's safest to just tell people to code-format it. Commented Sep 14, 2018 at 19:33
  • 1
    Idea sounds good, but I would prefer to see image (screenshot) of error along with its text version. Not all users can correctly copy text of error and paste it; at the same time screenshot is more valuable because it helps to see the whole error message (with address and description). As an example with image of error look at this post. I also totally agree with the first answer - formatting error message with blockquotes is not good method to display error message. Commented Sep 16, 2018 at 13:49

2 Answers 2

5

Add a > to the beginning of an error message to format as blockquotes or indent by 4 spaces to format as a code block, depending on what seems appropriate.

This approach is far from perfect. The problem with using code blocks for error messages is that they're not wrapped. So if you have a long sentence in error message, it all goes to one line with horizontal scroll. This is pretty annoying, to be honest. Sometimes it is actually worse than unformatted message dump.

On the other hand, using blockquote will most likely damage quoted content, especially if you use the Blockquote button in the editor. It will eat new lines, does not keep formatting from source and it will interpret as markdown things that should not be touched (just try post MySQL error message, where ` is used for quoting column names).

If we want to improve something we should start with the editor. Currently, there is no convenient way to paste error messages - using the blockquote button pretty often damages quoted content, using code blocks for non-code does not work well, and working with indentation is a pain. Any improvement to the editor should give much better results than another help page, which most of the new users will not even notice. Not mention that in the current state such guide will be either overcomplicated or incomplete and ambiguous.

0
3

As you can see in: Should we display a warning when users include images?

@Shog9 posted an answer, stating there is already guidance on the image upload for users with <= 15 reputation. I feel it wouldn't hurt to increase this threshold or even remove it altogether.

Taken from his post, this is what the dialog looks like with the warning:

enter image description here

The ongoing issue is that folks don't read help text. I still think my suggestion for the image upload dialog would be more effective...

enter image description here

You must log in to answer this question.

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