UNPKG

camstreamerlib

Version:

Helper library for CamStreamer ACAP applications.

133 lines (132 loc) 4.09 kB
export class ServiceUnavailableError extends Error { constructor() { super('Service is unavailable.'); this.name = 'ServiceUnavailableError'; } } export class ServiceNotFoundError extends Error { constructor() { super('Service not found.'); this.name = 'ServiceNotFoundError'; } } export class ParsingBlobError extends Error { constructor(err) { super('Error parsing response as Blob: ' + err); this.name = 'ParsingBlobError'; } } export class JsonParseError extends Error { constructor(paramName, data) { super(`Error: in JSON parsing of ${paramName}. Cannot parse: ${data}`); this.name = 'JsonParseError'; } } export class ParameterNotFoundError extends Error { constructor(paramName) { super(`Error: no parameter '${paramName}' was found`); this.name = 'ParameterNotFoundError'; } } export class SettingParameterError extends Error { constructor(message) { super(`Error setting parameter to camera: ${message}`); this.name = 'SettingParameterError'; } } export class ApplicationAPIError extends Error { constructor(action, res) { super(`[APP ${action}] Error: ` + res); this.name = 'ApplicationAPIError'; } } export class SDCardActionError extends Error { constructor(action, res) { super(`[SD_CARD ${action}] Error: ` + res); this.name = 'SDCardActionError'; } } export class SDCardJobError extends Error { constructor() { super('Error while fetching SD card job progress'); this.name = 'SDCardJobError'; } } const MAX_FPS_ERROR_MESSAGES = { MALFORMED_REPLY: 'Malformed reply from camera', CHANNEL_NOT_FOUND: 'Video channel not found.', CAPTURE_MODE_NOT_FOUND: 'No enabled capture mode found.', FPS_NOT_SPECIFIED: 'Max fps not specified for given capture mode.', }; export class MaxFPSError extends Error { constructor(state) { super(`[MAX_FPS ${state}] Error: ` + MAX_FPS_ERROR_MESSAGES[state]); this.name = 'MaxFPSError'; } } export class NoDeviceInfoError extends Error { constructor() { super('Did not get any data from remote camera'); this.name = 'NoDeviceInfoError'; } } export class FetchDeviceInfoError extends Error { constructor(err) { super('Error fetching remote camera data: ' + err); this.name = 'NoDeviceInfoFromCameraError'; } } export class AddNewClipError extends Error { constructor(message) { super('Error adding new clip: ' + message); this.name = 'AddNewClipError'; } } export class PtzNotSupportedError extends Error { constructor() { super('Ptz not supported.'); this.name = 'PtzNotSupportedError'; } } export class StorageDataFetchError extends Error { constructor(err) { super('Error fetching storage data: ' + err); this.name = 'StorageDataFetchError'; } } export class WsAuthorizationError extends Error { constructor(message) { super('Server error on ws authorization: ' + message); this.name = 'WsAuthorizationError'; } } export class UtcTimeFetchError extends Error { constructor(message) { super('Server error on get UTC time: ' + message); this.name = 'UtcTimeFetchError'; } } export class TimezoneNotSetupError extends Error { constructor() { super('Time zone not setup on the device'); this.name = 'TimezoneNotSetupError'; } } export class TimezoneFetchError extends Error { constructor(err) { super('Error fetching time zone information: ' + err); this.name = 'TimezoneFetchError'; } } export class ResetCalibrationError extends Error { constructor(type, err) { super('Error resetting ' + type.toLowerCase() + ' calibration: ' + err); this.name = 'ResetCalibrationError'; } } export class ImportSettingsError extends Error { constructor(err) { super('Error importing settings: ' + err); this.name = 'ImportSettingsError'; } }