Changing error level doesnt change the script you get redirected to upon pressing the error in the output

Reproduction Steps:

We need to call an erroring function that’s in a different script from the source, we’ll do it like so:

  1. Create a ModuleScript and parent it to ServerScriptService that has the following source code:
return function(level)
    error("Error", level)
end
  1. Create a Script and parent it to ServerScriptService that has the following source code:
require(script.Parent.ModuleScript)(1)
  1. Press Run and look at the output

Behavior and expectations:

  • When the error level is 1 aka the default, the output logs the following:
  18:55:30.734  ServerScriptService.ModuleScript:2: Error  -  Server - ModuleScript:2
  18:55:30.734  Stack Begin  -  Studio
  18:55:30.734  Script 'ServerScriptService.ModuleScript', Line 2  -  Studio - ModuleScript:2
  18:55:30.735  Script 'ServerScriptService.Script', Line 1  -  Studio - Script:1
  18:55:30.735  Stack End  -  Studio

which tells us the error originates from ServerScriptService.ModuleScript and when you press the red text in the Output window it opens that ModuleScript as expected:


  • When the error level is 2 the output logs the following:
  19:00:04.751  ServerScriptService.Script:1: Error  -  Server - ModuleScript:2
  19:00:04.751  Stack Begin  -  Studio
  19:00:04.751  Script 'ServerScriptService.ModuleScript', Line 2  -  Studio - ModuleScript:2
  19:00:04.751  Script 'ServerScriptService.Script', Line 1  -  Studio - Script:1
  19:00:04.751  Stack End  -  Studio

which now tells us the error originates from ServerScriptService.Script instead of ModuleScript as expected, but when you press the red text in the Output window it opens that ModuleScript instead of the Script:


Pressing the error in the output window seems to always redirect you to the beginning of the stack trace instead of the error level.

Here’s the place file for faster bug replication:
error level.rbxl (54.3 KB)

2 Likes

Thanks for the report! I filed a ticket in our internal database and we’ll follow up when we have an update for you.

‘level’ argument is only to specify what is put into the string error message, Studio Output cannot know what level was passed.

And I’m not sure Studio should trust the text and try to extract path and line number from the error string that could contain anything.
For example, you can do error("ServerScriptService.UnrelatedScript:20000000 Trust me", -1)

So this report looks more like a feature request and I don’t think there is a reliable way for us to implement it.

1 Like

You can programmatically get the error source using debug.info with the same level specified in the error function, the output cant do something similar?