RoSentry Docs

Capturing Errors and Context

Capture methods, user context, tags, breadcrumbs, and scope isolation.

Primary capture APIs

RoSentry.captureException(err, options)
RoSentry.captureMessage("message", options)
RoSentry.debug("message", data)
RoSentry.info("message", data)
RoSentry.warn("message", data)
RoSentry.log("message", data) -- alias for info

Capture options

{
    level = "error" | "warn" | "info" | "debug",
    stackTrace = "...", -- optional custom stack
    context = { ... },    -- custom object
    tags = {"tag1", "tag2"}
}

User context

RoSentry.setUser(player.UserId, player.Name, {
    team = "red",
    region = "us-east",
})

RoSentry.clearUser()

Setting player.Name enables player-name searching in the dashboard.

RoSentry.addBreadcrumb("economy", "Purchase started", { item = "Sword" })
RoSentry.setTag("game_mode", "ranked")
RoSentry.setExtra("server_uptime", 12345)

Scope isolation

withScope lets you add temporary tags/context without mutating global scope.

RoSentry.withScope(function(scope)
    scope.setTag("flow", "checkout")
    scope.setExtra("cart_total", 1200)
    RoSentry.captureMessage("Checkout started", { level = "info" })
end)

Auto-capture behavior

If autoCapture = true, SDK connects to ScriptContext.Error and automatically captures script errors.

If captureWarnings = true, SDK also captures warning output through LogService.MessageOut.

On this page