@neirth/sony-camera-mcp
Version:
MCP Server for controlling Sony Alpha 6100 camera
40 lines • 1.12 kB
JavaScript
/**
* Camera-specific error with detailed information
*/
export class CameraError extends Error {
code;
retriable;
details;
constructor(code, message, retriable = false, details) {
super(message);
this.code = code;
this.retriable = retriable;
this.details = details;
this.name = 'CameraError';
}
/**
* Indicate if the error can be retried
*/
isRetriable() {
return this.retriable;
}
/**
* Gets a detailed description of the error
*/
getDetailedMessage() {
return `${this.name} [${this.code}]: ${this.message}${this.details ? `\nDetalles: ${JSON.stringify(this.details)}` : ''}`;
}
}
/**
* Type validation utilities
*/
export const ensureArray = (value) => {
return Array.isArray(value) ? value : [value];
};
export const ensureTuple = (value) => {
if (!Array.isArray(value) || value.length !== 1) {
throw new CameraError(8 /* CameraErrorCode.ILLEGAL_TYPE */, 'Value must be an array with exactly one element', false);
}
return [value[0]];
};
//# sourceMappingURL=models.js.map