@avaya/infinity-agent-sdk - v1.0.0
    Preparing search index...

    The error class thrown by all public methods of the Avaya Infinity Agent SDK.

    Every error carries a unique code string (ASE-XXXX) that identifies the specific failure, and a human-readable message.

    // init() can fail for several distinct reasons - you can branch on code to handle each case
    try {
    const user = await AvayaInfinityAgentSdk.init({
    avayaInfinityHost: "api.avayacloud.com",
    clientId: "your-client-id",
    oAuthRedirectUri: "https://your-app.com/callback.html",
    oAuthMode: "popup",
    });
    } catch (err) {
    if (AvayaInfinityAgentSdkError.is(err)) {
    switch (err.code) {
    case "ASE-1003":
    // Popup was blocked by the browser - show a message asking the user to allow popups
    showBanner("Please allow popups for this site and try again");
    break;
    case "ASE-1004":
    // User closed the popup before completing login - offer a retry
    showBanner("Sign-in was cancelled. Click login to try again");
    break;
    case "ASE-1005":
    // Authenticated but session creation failed - likely a backend issue
    showBanner("Failed to create session. Please contact your administrator");
    break;
    case "ASE-1008":
    // Could not establish WebSocket - network or host config issue
    showBanner("Unable to connect. Check your network and try again");
    break;
    default:
    showBanner(err.message);
    }
    }
    }

    Hierarchy

    • Error
      • AvayaInfinityAgentSdkError
    Index

    Properties

    Methods

    Properties

    code: string

    Error code identifying the specific failure.

    Format: ASE-XXXX where the numeric prefix indicates the error family. It is recommended to use this to branch on error type rather than parsing message.

    detail?: string

    A human-readable string describing the specific underlying cause of this error.

    Provides more granular context than message - for example, the raw error from a failed network request or a response parsing failure. Useful for logging and displaying specific failure reasons to the user.

    try {
    await AvayaInfinityAgentSdk.init(params);
    } catch (err: unknown) {
    if (AvayaInfinityAgentSdkError.is(err)) {
    const displayMessage = err.detail ?? err.message;
    showBanner(displayMessage);
    }
    }
    metadata?: Record<string, unknown>

    Structured diagnostic context attached to this error.

    Provides additional information about the circumstances under which the error occurred, such as which SDK operation was being executed. Intended for logging and support diagnostics rather than branching logic - use code for that.

    } catch (err: unknown) {
    if (AvayaInfinityAgentSdkError.is(err)) {
    logger.error("SDK operation failed", {
    code: err.code,
    metadata: err.metadata,
    message: err.message,
    });
    }
    }

    Methods

    • Returns the underlying cause of this error, if any.

      Useful for inspecting the original network error, IdP response, or internal exception that triggered this SDK error.

      Returns unknown

      The raw cause value, or undefined if none was provided

      const cause = err.unwrap();
      if (cause instanceof TypeError) {
      console.error("Network issue:", cause);
      }
    • Type predicate that checks whether a value is an AvayaInfinityAgentSdkError.

      Works across iframe boundaries and multiple SDK instances where instanceof may fail due to different class references.

      Parameters

      • value: unknown

        The value to check

      Returns value is AvayaInfinityAgentSdkError

      true if the value is an AvayaInfinityAgentSdkError, false otherwise

      try{
      await AvayaInfinityAgentSdk.destroy();
      } catch (err: unknown) {
      if (AvayaInfinityAgentSdkError.is(err)) {
      console.error(err.code, err.message); // safely typed as AvayaInfinityAgentSdkError
      }
      }