Error handling

The error category contains functionality for handling errors produced by the Dragon Copilot SDK.

Add and remove event listeners

Use the following:

  • DragonCopilotSDK.dragon.error.events.addEventListener("errorOccurred", ...)

  • DragonCopilotSDK.dragon.error.events.removeEventListener("errorOccurred", ...)

When an error occurs in the Dragon Copilot SDK outside the context of an API call, the SDK raises the errorOccurred event. For example, issues with user authentication or with the server connection.

Details in the event include:

Property Description
errorCode The error code. For more information, see the documentation on each error code category.
title The error title, usually indicating the main issue.
message More information on the error.

Integration errors

DragonCopilotSDK.dragon.error.IntegrationError provides information when an API is called incorrectly.

An object containing all public error codes is available at DragonCopilotSDK.dragon.error.IntegrationErrorCodes. When an integration error is thrown, the error code property has one of the following values:

Error code Description
system_not_initialized Some APIs can't be called before the DragonCopilotSDK.dragon.initialize() call. In these cases, an IntegrationError is thrown with this error code.
invalid_arguments An API has been called with invalid arguments.
invalid_action An API has been called incorrectly, for example because of an invalid state or invalid environment.

In addition to error codes, some errors contain more detailed error messages in the subError string array property.

Internal errors

dragon.error.InternalError provides information on errors internal to the Dragon Copilot SDK. To help us fix these errors, provide your Microsoft contact with the traceId and dmsSessionId, if present.

Property Description
traceId The ID that correlates the logs.
dmsSessionId? The ID that correlates the logs to a specific DMS session if there was one.

See also

API reference