errorcoredocsbeta
Framework guides

Hono

npm install errorcore

Initialize Errorcore in server runtime code, then attach capture through Hono's error path once the adapter is confirmed.

import { Hono } from "hono";
import { captureError, flush, init } from "errorcore";
import { honoMiddleware } from "errorcore/hono";

init({
  service: process.env.ERRORCORE_SERVICE_NAME,
  deploymentEnv: process.env.ERRORCORE_ENVIRONMENT,
  transport: {
    type: "http",
    url: process.env.ERRORCORE_INGEST_URL ?? "https://api-production-7ecf.up.railway.app/v1/ingest",
    apiKey: process.env.ERRORCORE_API_KEY,
  },
  encryptionKey: process.env.ERRORCORE_DEK,
});

const app = new Hono();
app.use("*", honoMiddleware());

app.get("/errorcore-test", async (context) => {
  captureError(new Error("errorcore test error"));
  await flush();
  return context.json({ sent: true }, 202);
});

honoMiddleware() attaches request context and captures errors that escape downstream handlers.

On this page