Skip to content

Add an unhandledRejection callback in the examples and the documentation #14

@massi-ang

Description

@massi-ang

The StreamManagerClient constructor implicitly calls the asynchronous method _connect() to the stream manager service. If the connection fails, the promise is rejected, and must be caught via an unhandledRejection callback (https://nodejs.org/api/process.html#process_event_unhandledrejection).

This information should be added to the documentation of the StreamManagerClient.

* @example <caption>StreamManager Usage</caption>
* const { StreamManagerClient } = require('aws-greengrass-core-sdk/stream-manager');
* const client = new StreamManagerClient();
* c.onConnected(async () => {
* // Do work with the client (c) here.
* });
*/

const client = new StreamManagerClient();

process.on('unhandledRejection', (reason, promise) => {
  console.log('Unhandled Rejection at:', promise, 'reason:', reason);
  // Application specific logging, throwing an error, or other logic here
});

client.on('connected', () => {
}
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions