Skip to main content

print_error

Function print_error 

Source
pub fn print_error(err: &Error, exit_code: CliExitCode)
Expand description

Print error with appropriate formatting and helpful hint

Formats error output consistently across the CLI with:

  • Error message with full context chain
  • Context-aware hint for resolution

§Examples

use anyhow::anyhow;
use cqlite_cli::error::{print_error, classify_error};

let err = anyhow!("Unsupported query: JOIN not supported");
let exit_code = classify_error(&err);
print_error(&err, exit_code);
// Output:
// Error: Unsupported query: JOIN not supported
//
// Hint: Supported SELECT features in M2:
//   • SELECT with WHERE on partition/primary key
//   ...