Skip to main content

LensStudio:AssetLibrary.ServiceError

Class

The callback of an errored fetch call by the "LensStudio:AssetLibrary".AssetListService.

Index

Properties

Example

// ServiceError is populated on response.error when an asset library
// request fails (response.ok === false and response.cancelled === false).
const provider = this.pluginSystem.findInterface(
IAssetLibraryProvider.interfaceId
) as import('LensStudio:AssetLibrary').IAssetLibraryProvider;

const envSetting = new EnvironmentSetting();
envSetting.environment = Environment.Production;
envSetting.space = Space.Public;

// Request a non-existent asset id to force a failure.
const response = await provider.assetsByIdsService.fetchAsync(
new GetAssetsByIdsRequest(envSetting, ['does-not-exist'])
);

if (!response.ok && !response.cancelled && response.error) {
console.log('ServiceError description:', response.error.description);
}

Properties

description

readonly description: string

Human-readable message describing the service error.

See also

"LensStudio:AssetLibrary".Asset.