Skip to content

SDK API Reference / hasHttpStatus

Function: hasHttpStatus()

hasHttpStatus(error, status): boolean

Check if an error carries a specific HTTP status, via a status property or a wrapped cause.

Status-only — unlike isHttp404Error/isHttp400Error, this never falls back to scanning the message text. A message can legitimately contain any number (a row count, a limit, a journey id) that happens to match the status being checked for; a real HTTPClientError always sets status, so callers that need a precise, gate-worthy check (deciding what error message to show the user, not just logging) should use this instead.

Parameters

error

unknown

status

number

Returns

boolean