LSEG Data Library for TypeScript

onError

Attaches an event handler function to the stream, which will be called when an error message is received for some of the requested instruments.

Syntax

stream.onError(callback: OMMStreamErrorCb)

Parameters

Value Description Data type Optional Default value
callback OMMStreamErrorCb function (see OMMStream.Event). function No -

Returned value

The current OMMStream object.

Usage

The following example demonstrates how to display messages received when a data retrieval error happens:

const stream = Delivery.OMMStream.Definition({
    name: 'EUR=',
    fields: ['DSPLY_NAME']
}).getStream();

await stream
    .onError((error, stream) => console.log(error, stream))
    .open();
61 words (0:19 mins)