Application Error Tracking
Route application errors and exceptions to the right team in real time.
Application errors need immediate attention — but not all errors are equal. Route critical errors to PagerDuty while sending warnings to Slack, without configuring each service individually.
Express.js error handler
app.use((err, req, res, next) => {
const priority = err.status >= 500 ? 5 : 3;
fetch("https://app.alphorn.dev/api/webhooks/wh_abc123", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
title: `${err.name}: ${err.message}`,
message: `${req.method} ${req.path}\n\nStack:\n${err.stack?.slice(0, 500)}`,
priority,
tags: ["error", `http-${err.status || 500}`, "backend"],
}),
}).catch(() => {}); // Don't block the error response
res.status(err.status || 500).json({ error: "Internal server error" });
});Python exception handler
import traceback
import requests
def notify_error(exc, context=""):
requests.post(
"https://app.alphorn.dev/api/webhooks/wh_abc123",
json={
"title": f"{type(exc).__name__}: {str(exc)[:100]}",
"message": f"{context}\n\n{traceback.format_exc()[:500]}",
"priority": 5,
"tags": ["error", "exception", "backend"],
},
timeout=5,
)
# Usage
try:
process_payment(order)
except Exception as e:
notify_error(e, context=f"Processing order {order.id}")
raiseFrontend errors
Catch unhandled errors in your frontend and forward them:
window.addEventListener("error", (event) => {
fetch("https://app.alphorn.dev/api/webhooks/wh_abc123", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
title: `Frontend error: ${event.message}`,
message: `${event.filename}:${event.lineno}\n\nUser-Agent: ${navigator.userAgent}`,
priority: 3,
tags: ["error", "frontend"],
}),
});
});Routing examples
| Channel | Filter | Purpose |
|---|---|---|
| Slack (#errors) | tags CONTAINS "error" | All errors visible to the team |
| PagerDuty | priority >= 5 AND tags CONTAINS "error" | Page on-call for 500s |
| Slack (#frontend) | tags CONTAINS "frontend" | Frontend-specific errors |
tags CONTAINS "error" | Full error archive |