Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/shared/sdk-client/src/LDClientImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,13 @@ export default class LDClientImpl implements LDClient {
*
* @param pristineContext The LDContext object to be identified.
* @param identifyOptions Optional configuration. See {@link LDIdentifyOptions}.
* @returns
* A Promise which resolves when the flag values for the specified context
* are available.
*
* @returns {Promise<void>}.
* The promise rejects if the identify timeout is exceeded. In client SDKs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it is also rejected on a bad context.

 if (!checkedContext.valid) {
      const error = new Error('Context was unspecified or had no key');
      this.logger.error(error);
      this.emitter.emit('error', context, error);
      return Promise.reject(error);
    }

I thought there was another case as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

     this.identifyErrorListener = (c: LDContext, err: Error) => {
        this.logger.debug(`error: ${err}, context: ${JSON.stringify(c)}`);
        reject(err);
      };

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found other bugs related to identify promise rejections when investigating this. I'll report back with an update once I resolve those bugs. Thank you for your patience.

* this defaults to 5s. You can provide a custom timeout in
* {@link LDIdentifyOptions | identifyOptions}.
*/
async identify(pristineContext: LDContext, identifyOptions?: LDIdentifyOptions): Promise<void> {
if (identifyOptions?.timeout) {
Expand Down
7 changes: 6 additions & 1 deletion packages/shared/sdk-client/src/api/LDClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ export interface LDClient {
* @param identifyOptions
* Optional configuration. Please see {@link LDIdentifyOptions}.
* @returns
* A Promise which resolves when the flag values for the specified context are available.
* A Promise which resolves when the flag values for the specified context
* are available.
*
* The promise rejects if the identify timeout is exceeded. In client SDKs
* this defaults to 5s. You can provide a custom timeout in
* {@link LDIdentifyOptions | identifyOptions}.
*/
identify(context: LDContext, identifyOptions?: LDIdentifyOptions): Promise<void>;

Expand Down