Today I had faced this problem, and I tried to find the line that had the error in it where the OP had a question about it, but other lines in the posted code were totally unrelated to problem.
After that I thought that I should edit the question and delete all unrelated code parts and just leave the line that contains the error. Should I do that or not? However, this is just an example. Should we delete all unrelated parts of code in editing?