该服务控制所有 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!")