此服务控制所有 BaseScript 对象。 大多数此服务的属性和方法都是内部使用。
概要
活动
发生错误时。
属性
方法
活动
Error
发生错误时。
参数
代码示例
When an error occurs, this example prints the name of the script that errored, the reason it errored, and a trace of the error.
ScriptContext.Error
local ScriptContext = game:GetService("ScriptContext")
local function onError(message, trace, script)
print(script:GetFullName(), "errored!")
print("Reason:", message)
print("Trace:", trace)
end
ScriptContext.Error:Connect(onError)
-- Somewhere, in another script
error("Error occurred!")