Skip to content

Call.call() suppresses the internalError alert because async checkIfHAError isn't awaited #1851

Description

@ChrisNolan

Summary

In packages/ringcentral-integration/modules/Call/Call.ts, the catch block in call() guards the fallback internalError alert with AvailabilityMonitor.checkIfHAError(error). That method is async and returns a Promise, but it isn't awaited. !<Promise> is always false, so whenever an AvailabilityMonitor is registered, the fallback danger alert never fires — call failures that don't match an earlier branch (e.g. a make-call transport timeout) fail silently for the user.

cc @embbnux — noticed while investigating ringcentral/ringcentral-embeddable#1215 (PR not filed yet). Since you're ~12h ahead, flagging here in case it's a quick overnight fix.

Location

modules/Call/Call.ts, in the call() catch (error) block:

} else if (error.message !== 'Refresh token has expired') {
  if (
    !this._deps.availabilityMonitor ||
    !this._deps.availabilityMonitor.checkIfHAError(error)   // ⬅️ not awaited
  ) {
    this._deps.alert.danger({
      message: callErrors.internalError,
      payload: error,
    });
  }
}

AvailabilityMonitor.checkIfHAError is async:

async checkIfHAError(error) { ... return isHAError(error) || errMessage === errorMessages.serviceLimited; }

Impact

  • With an AvailabilityMonitor registered, !checkIfHAError(error) is !Promise → always false, so the internalError alert is never shown.
  • Non-classified call errors (e.g. a make-call timeout with a .message and no .response) surface no UI at all; the error is rethrown and swallowed by the caller (DialerUI.call only console.logs it).
  • Downstream apps (e.g. RingCentral Embeddable) see calls "silently" fail with no banner.

Suggested fix

Await the async check (the enclosing call() is already async):

} else if (error.message !== 'Refresh token has expired') {
  if (
    !this._deps.availabilityMonitor ||
    !(await this._deps.availabilityMonitor.checkIfHAError(error))
  ) {
    this._deps.alert.danger({
      message: callErrors.internalError,
      payload: error,
    });
  }
}

Note: ActiveCallControl in RingCentral Embeddable already uses the awaited form (!(await this._deps.availabilityMonitor?.checkIfHAError(error))), which appears to be the intended pattern.

Version

@ringcentral-integration/commons@0.14.0

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