Urgent.News

What's breaking now, across thousands of outlets.

Tech

Logistics Error Tracking: 4 Signals for HTTP Exceptions, Cron, and Queue Workers

Short answer: in NestJS, use an exception filter and interceptor for HTTP error tracking, add explicit capture boundaries around cron jobs and queue workers, and page only when a scheduled import has stopped producing results. That distinction matters in logistics. An import can throw loudly, retry, and still deliver every expected record. It can also stop quietly after a scheduler change and…

In NestJS, implement four distinct signals for tracking logistics errors: HTTP exceptions, cron invocations, queue worker failures, and import outcomes. Each signal serves a specific purpose and should be captured at the appropriate boundary.

For HTTP exceptions, use an exception filter to handle uncaught request errors. Cron jobs should have an interceptor to capture their firing, while queue workers require a separate interceptor for message processing.

Record an explicit outcome for each import definition, whether it succeeds, fails, or exhausts. The alert evaluator checks if the latest successful outcome is older than the allowed interval plus a grace period, without considering the number of stack traces.

A missing outcome is the strongest signal indicating a scheduled logistics import has stopped. For each import definition, record an invocation followed by a terminal outcome: succeeded, failed, or exhausted.

Connect HTTP exceptions, cron jobs, and queue workers through a small, transport-neutral capture function. Avoid stretching one framework hook across all execution models. Each adapter should map local context into the same event shape, containing stable fields such as event time, execution kind, operation name, outcome, error class, and correlation identifier.

Use a generic intake contract for error capture, posting data like occurred_at, execution_kind, operation, outcome, error_class, correlation_id, and dimensions. Keep high-detail values like shipment IDs or exception messages in sampled event payloads with shorter retention.

Normalize errors once, preserving the original exception detail in the event body while using a bounded taxonomy for aggregation. Capture failures at the boundary that can decide the outcome, avoiding multiple unrelated error events.

Keep alert labels small, focusing on environment, operation, and depot, with carrier as an event attribute if needed. Correlation IDs must not be labels, and retention should align with the specific question each data class answers.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Wednesday 14 October →