Lua/Scribunto is the only remaining piece of MediaWiki (with a configuration typical for the WMF cluster) which does not have a way to log errors (apart from printing them to the page). I wonder if it made sense to add an error reporting option and channel the output to Sentry?
|T89049 Make log responsibilities changes
|T106913 Use Sentry on non-production Wikimedia wikis, Toolforge and other sites/tools
|T91724 Set up and test Sentry on Labs for non-JS error logging
|T106915 Use Sentry in production
|T91358 Log Scribunto errors in Sentry