/**
 * Custom error classes for the Ladder Engine
 */

export class LadderError extends Error {
  constructor(message: string) {
    super(message);
    this.name = 'LadderError';
  }
}

export class InvalidMemoryAccessError extends LadderError {
  constructor(address: string) {
    super(`Invalid memory access at address: ${address}`);
    this.name = 'InvalidMemoryAccessError';
  }
}

export class CircularLogicError extends LadderError {
  constructor(rungId: string) {
    super(`Circular logic detected in rung: ${rungId}`);
    this.name = 'CircularLogicError';
  }
}

export class MathOperationError extends LadderError {
  constructor(operation: string, details: string) {
    super(`Math operation error (${operation}): ${details}`);
    this.name = 'MathOperationError';
  }
}