Skip to content

Logging and errors

Clear logs and errors make pipeline runs easier to review without hiding data quality problems.

What to log

Useful execution log messages include:

  • the number of rows read and published;
  • the number of records filtered or rejected;
  • the selected branch of a processing rule;
  • a non-sensitive configuration value that materially affects the result; and
  • warnings about unusual but permitted input.
ft.log(f"Read {rows.num_rows} rows")
ft.log(f"Removed {removed_count} rows with missing measurements", "warn")
ft.log(f"Published {result.num_rows} rows")

Do not log access tokens, credentials, entire datasets, confidential note text, or raw file contents.

Raise specific errors

Raise an error when the script cannot produce a trustworthy output. Describe what was expected and what was missing or invalid.

if "sample_id" not in rows.column_names:
    raise ValueError("rows is missing required column sample_id")
if (!("sample_id" %in% names(rows))) {
  stop("rows is missing required column sample_id")
}

Avoid catching every exception. Broad error handling can turn corrupt input or an invalid calculation into an apparently successful empty output.

SDK error categories

Python SDK errors inherit from ft.FlaskTrackError:

Error Meaning
ft.ValidationError A port name, output option, path, or value is invalid
ft.BrokerRequestError The requested port or operation was rejected
ft.BrokerConnectionError The local pipeline runtime could not be reached
ft.BrokerProtocolError The runtime returned incomplete or invalid data

Most scripts should allow these errors to stop the run. If you catch one to add context, re-raise it so the run still fails.

try:
    rows = ft.input_table("rows")
except ft.FlaskTrackError:
    ft.log("Unable to load the declared rows input", "error")
    raise

R SDK errors use condition classes beginning with flasktrack_, including flasktrack_validation_error, flasktrack_broker_error, and flasktrack_io_error.