Provide programmatic context for ScriptContext.Error

As a programmer, lots of issues need to be tracked, fixed, and monitored for regression when pushing updates. Currently, it’s almost impossible to create a robust error logging solution via a service like Sentry due to the inability to fetch the context of an error. I’ve tried logging errors across multiple projects, but as soon as you change the source of a script causing an error, all of your existing error logs become obsolete due to their stack traces falling out of sync with the most up-to-date source code.

The only solution to this problem at the moment would be to manually run a plugin that fetches all sources in your game, save them all to a module, and look up the source context whenever ScriptContext.Error is fired. This is incredibly inefficient, redundant, and a potential security risk.

Providing a 4th parameter to ScriptContext.Error with 4 or 5 lines of surrounding code context would help drastically in tracking errors at runtime and eliminate the need to unlock Script.Source.

6 Likes