class RatatuiRuby::Tea::Command::Error

Error message from a failed command.

Commands run in background threads. Exceptions bubble up silently. Your update function never sees them. Backtraces in STDERR corrupt the TUI.

The runtime catches exceptions and wraps them in Error messages. Pattern match on Error in your update function. Display the error, log it, or recover.

Use it to surface failures from HTTP requests, file I/O, or external processes.

Examples

Update = ->(message, model) {
  case message
  in Command::Error[command:, exception:]
    # Show error toast
    [model.with(error: exception.message), nil]
  in Command::Error[command: Command::Http, exception:]
    # Retry HTTP request
    [model, command]
  in Command::Error
    # Log and continue
    warn "Command failed: #{message.exception}"
    [model, nil]
  end
}