Handle CLI send errors without panicking

This commit is contained in:
Gregory Schier
2026-02-16 09:33:43 -08:00
parent ea0b083d25
commit e48a0894de
3 changed files with 60 additions and 21 deletions

View File

@@ -2,6 +2,17 @@ use crate::cli::SendArgs;
use crate::commands::request;
use crate::context::CliContext;
pub async fn run(ctx: &CliContext, args: SendArgs, environment: Option<&str>, verbose: bool) {
request::send_request_by_id(ctx, &args.request_id, environment, verbose).await;
pub async fn run(
ctx: &CliContext,
args: SendArgs,
environment: Option<&str>,
verbose: bool,
) -> i32 {
match request::send_request_by_id(ctx, &args.request_id, environment, verbose).await {
Ok(()) => 0,
Err(error) => {
eprintln!("Error: {error}");
1
}
}
}