Skip to content

Function: vastErrorToSvtaErrorCode() ​

ts
function vastErrorToSvtaErrorCode(vastError): number;

Defined in: vastErrorToSvtaErrorCode.ts:21

Embed an IAB VAST error code into the SVTA Advertising error category, per the external code embedding rule of SVTA2070. VAST error 301 becomes 7301. The four-digit VAST error 1009 (empty VAST response) does not fit a three-digit index, so SVTA2070 maps it to 7999.

Values outside the valid VAST error code range (integers 100-999, or 1009) return the unknown advertising error code (7000) rather than throwing, so error reporting paths cannot fail.

Parameters ​

vastError ​

number

An IAB VAST error code (100-999, or 1009).

Returns ​

number

The SVTA advertising error code embedding the VAST error.

Example ​

ts
const code = vastErrorToSvtaErrorCode(301)

assert(code === 7301)

A Streaming Video Technology Alliance project.