Class: DSPy::ErrorFormatter

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dspy/error_formatter.rb

Overview

Utility class for formatting complex error messages into human-readable format

Class Method Summary collapse

Class Method Details

.format_error(error_message, context = nil) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/dspy/error_formatter.rb', line 12

def self.format_error(error_message, context = nil)
  # Try different error patterns in order of specificity
  if sorbet_type_error?(error_message)
    format_sorbet_type_error(error_message)
  elsif argument_error?(error_message)
    format_argument_error(error_message)
  else
    # Fallback to original message with minor cleanup
    clean_error_message(error_message)
  end
end