Skip to content

format parse error from code

Mojo function 🔭

def format_parse_error_from_code(code: FastxErrorCode, record_number: Int, line_number: Int, file_position: Int64, record_snippet: String = "") -> String

Build full ParseError string from error code and context (cold path).

Returns the full formatted error string, including contextual lines such as ā€œRecord numberā€, ā€œLine numberā€, ā€œFile positionā€, and ā€œRecord snippetā€ when that information is available. This is used by callers that raise Error(String) so that String(Error) already contains rich context.

Args:

  • code (FastxErrorCode)
  • record_number (Int)
  • line_number (Int)
  • file_position (Int64)
  • record_snippet (String)

Returns:

String