API Reference
Error Monitoring
Getting Started
Welcome to Highlight
Integrations
Product Features
Session Replay
Tips
Menu

H.consumeError()

consumeError: ( error: Error, secureSessionId: string, requestId: string, ) => void
Copy
Purpose

H.consumeError() reports an error and its corresponding stack trace to Highlight. The secureSessionId and requestId properties are Highlight ids used to link an error to the session in which the error was thrown. These properties are sent via a header and included in every request to your backend once the Highlight client is initialized. They can be parsed using the H.parseHeaders() helper method.

Example Usage
import * as http from 'http' import { H } from '@highlight-run/node' const onError = (request: http.IncomingMessage, error: Error): void => { const parsed = H.parseHeaders(request.headers) if (parsed !== undefined) { H.consumeError(error, parsed.secureSessionId, parsed.requestId) } }
Copy
Arguments

error : Error

  • The error to be reported to Highlight

secureSessionId : string

  • A randomized id representing the Highlight session in which an error was thrown. This can be parsed from the network request's headers using H.parseHeaders().

requestId

  • A randomized id generated by the Highlight client representing the request for which an error was thrown. This can be parsed from the network request's headers using H.parseHeaders().