Skip to content

ValidationError

Mojo struct 🡭

@memory_only
struct ValidationError

Error raised during FASTQ record validation.

  • message (String)
  • record_number (Int)
  • field (String)
  • record_snippet (String)

AnyType, ImplicitlyDestructible, Writable

def __init__(out self, message: String, record_number: Int = 0, field: String = "", record_snippet: String = "")

Initialize ValidationError with message and optional context.

Args:

  • message (String): The error message.
  • record_number (Int): 1-indexed record number where error occurred (0 if unknown).
  • field (String): Field name where validation failed (e.g., “header”, “sequence”, “quality”).
  • record_snippet (String): First 100-200 chars of problematic record (empty if unavailable).
  • self (Self)

Returns:

Self

def write_to[w: Writer](self, mut writer: w)

Write error to writer without building an intermediate String.

Parameters:

  • w (Writer)

Args:

  • self (Self)
  • writer (w)