Description of bug:
Clicking the first message in a stack trace opens up the wrong script/line number when caused by an error
statement with a level argument given. The text of the error is as expected, but when clicking it in the Output window, it does not open the editor at the right statement.
Reproduction:
Put the following in a Script in ServerScriptService:
function C(i)
if i >= 5 then
error("An error occurred because of something two levels higher", 3)
end
end
function B(i)
C(i)
end
function A()
-- passing an illegal value to B, if there is an error it should refer here:
local i = 5
B(i)
end
A()
When running the place, the Output window shows the following:
The text displayed here is absolutely correct. Notice that the first line refers to line 14, which is correct because I throw the error with a level of 2, so the error position should be at the A() call, as expected. However, if you click the first line to go to the source where the error occurred, you will actually go to line 3 instead of line 14. This is a bug.
The bug also happens if calls through multiple scripts/modules are performed. Here is a reproduction file for the same example as above, but then with A, B, and C spread over modules instead. The stack trace will say the error occurred in module A at line 5 which is correct, but clicking the first message will open module C at line 3 instead.
Repro_StackTraceLevelBug.rbxl (12.8 KB)
Desired behaviour:
The correct script/line should be opened when I click the first stack trace item, as displayed in the text of the stack trace, no matter what level I feed to the error
function to cause the stack trace.