matterbridge-roborock-vacuum-plugin
Version:
Matterbridge Roborock Vacuum Plugin
56 lines • 1.64 kB
JavaScript
import { BaseError } from './BaseError.js';
/**
* Base class for configuration-related errors.
*/
export class ConfigurationError extends BaseError {
constructor(message, metadata) {
super(message, 'CONFIG_ERROR', 400, metadata);
}
}
/**
* Thrown when required configuration field is missing.
*/
export class MissingConfigurationError extends ConfigurationError {
constructor(field) {
super(`Required configuration field is missing: ${field}`, {
reason: 'MISSING_FIELD',
field,
});
}
}
/**
* Thrown when configuration value is invalid.
*/
export class InvalidConfigurationError extends ConfigurationError {
constructor(field, value, expectedFormat) {
super(`Invalid configuration value for field: ${field}`, {
reason: 'INVALID_VALUE',
field,
value,
expectedFormat,
});
}
}
/**
* Thrown when credentials are missing from configuration.
*/
export class MissingCredentialsError extends ConfigurationError {
constructor() {
super('Authentication credentials are missing. Please provide username and password or verification code.', {
reason: 'MISSING_CREDENTIALS',
});
}
}
/**
* Thrown when region configuration is invalid.
*/
export class InvalidRegionError extends ConfigurationError {
constructor(region, validRegions) {
super(`Invalid region: ${region}. Valid regions: ${validRegions.join(', ')}`, {
reason: 'INVALID_REGION',
region,
validRegions,
});
}
}
//# sourceMappingURL=ConfigurationError.js.map