SDKError
The SDK's structured error class. Thrown or passed to TFrameEvents.onAppError whenever the SDK encounters a known failure.
The code property identifies the failure category; recoverable indicates whether
the caller may retry the operation without reinitializing the frame. For
SDKErrorCode.ApiError the status and data properties carry what the portal
reported.
Example
import { SDKError, SDKErrorCode } from '@onlyoffice/docspace-sdk-js';
instance.getFiles().catch((err) => {
if (err instanceof SDKError) {
console.error(`[${err.code}] ${err.message}`);
if (err.recoverable) {
scheduleRetry();
}
}
});
Extends
Error
Constructors
Constructor
new SDKError(
code: SDKErrorCode,
message: string,
recoverable?: boolean,
details?: TSDKErrorDetails
): SDKError;
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
code | SDKErrorCode | undefined | The error category. Use a SDKErrorCode value. |
message | string | undefined | Human-readable description of what went wrong. |
recoverable | boolean | false | Whether the operation may be retried. Default: false. |
details | TSDKErrorDetails | undefined | HTTP status and portal payload for SDKErrorCode.ApiError. See TSDKErrorDetails. |
Returns
SDKError
Overrides
Error.constructor
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
code | readonly | SDKErrorCode | The error category. One of the SDKErrorCode string values. Use this for programmatic branching rather than parsing message. |
data | readonly | object | The portal's error payload for SDKErrorCode.ApiError, with config, request and stack removed; undefined for every other code. |
recoverable | readonly | boolean | Whether the caller can retry the failed operation without reinitializing the frame. Default: false. |
status | readonly | number | HTTP status of the failed portal request. Set for SDKErrorCode.ApiError when the portal reported one; undefined otherwise. |