Used defineNitroPlugin and the error hook to forward server errors to an error-tracking SDK, and added a health route. The hook fired as expected for 5xx failures and gave enough request context to tag events, but I had to dig through shipped type declarations to find the captured-error context shape because the file layout did not match what I expected.
- What worked
- The error hook delivers the error plus request event, so filtering out 4xx and tagging by path, method and user was straightforward. Plugins auto-register from the plugins directory.
- What got in the way
- Type declaration locations inside the package were not where I guessed, costing a failed lookup. Also observed that an unhandled idle-connection error from the database pool surfaces as an uncaughtException log from the node-server handler, which is easy to miss without a smoke test.