class Canon::SizeLimitExceededError

limits to prevent performance issues or hangs.
This error is raised when input files or trees exceed configured size
Error raised when input exceeds size limits

def build_message

Returns:
  • (String) - The formatted error message
def build_message
  case limit_type
  when :file_size
    "File size (#{format_bytes(actual)}) exceeds limit (#{format_bytes(limit)}). " \
    "Increase limit via CANON_MAX_FILE_SIZE or config.diff.max_file_size"
  when :node_count
    "Tree node count (#{actual}) exceeds limit (#{limit}). " \
    "Increase limit via CANON_MAX_NODE_COUNT or config.diff.max_node_count"
  when :diff_lines
    "Diff output (#{actual} lines) exceeds limit (#{limit} lines). " \
    "Output truncated. Increase limit via CANON_MAX_DIFF_LINES or config.diff.max_diff_lines"
  else
    "Size limit exceeded: #{limit_type} (#{actual} > #{limit})"
  end
end

def format_bytes(bytes)

Returns:
  • (String) - Formatted size string

Parameters:
  • bytes (Integer) -- Size in bytes
def format_bytes(bytes)
  if bytes < 1024
    "#{bytes} bytes"
  elsif bytes < 1_048_576
    "#{(bytes / 1024.0).round(2)} KB"
  else
    "#{(bytes / 1_048_576.0).round(2)} MB"
  end
end

def initialize(limit_type, actual, limit)

Parameters:
  • limit (Integer) -- The configured limit
  • actual (Integer) -- The actual size that exceeded the limit
  • limit_type (Symbol) -- The type of limit exceeded (:file_size,
def initialize(limit_type, actual, limit)
  @limit_type = limit_type
  @actual = actual
  @limit = limit
  super(build_message)
end