← All platforms

Iris error tracking

Your Iris routes deserve more than a recovered panic in a server log. The Sentry Iris integration sends the error report to Telebugs on your server.

~/hoofnotes  go get github.com/getsentry/sentry-go/iris
~/hoofnotes  nvim error_tracking.go main.go
package main
import "github.com/getsentry/sentry-go"
func initErrorTracking() error {
return sentry.Init(sentry.ClientOptions{
// Copy the complete Telebugs DSN, key and path included.
Dsn: "YOUR_TELEBUGS_DSN",
})
}
package main
import (
"time"
"github.com/getsentry/sentry-go"
sentryiris "github.com/getsentry/sentry-go/iris"
"github.com/kataras/iris/v12"
)
func main() {
if err := initErrorTracking(); err != nil {
panic(err)
}
defer sentry.Flush(2 * time.Second)
app := iris.Default()
app.Use(sentryiris.New(sentryiris.Options{Repanic: true}))
registerNotesRoutes(app)
app.Run(iris.Addr(":3000"))
}
~/hoofnotes  go run .

Space pauses or resumes. R replays. Escape shows the complete setup.

Hang on, I already use Sentry

Keep sentry-go and change its destination to your Telebugs DSN. Your error reports stay on your server. You don’t need a Sentry account.

Does this fit Iris middleware?

Yes. The Sentry integration joins the middleware chain and reports request panics. Iris can still recover the request while Telebugs keeps the backtrace for you.

What about errors I return instead of panicking?

Go errors are values. Report one explicitly with CaptureException when it matters. A middleware connection doesn’t automatically turn every returned error into a report.