@@ -14,21 +14,21 @@ use crate::commands::runbook::run_generate_runbook;
1414use crate :: commands:: simulator:: run_simulator;
1515use crate :: commands:: webhook:: run_webhook;
1616use clap:: Parser ;
17- use std:: process;
1817
1918use stellar_k8s:: controller:: archive_prune:: prune_archive;
2019use stellar_k8s:: controller:: diff:: diff;
2120use stellar_k8s:: version_check;
2221use stellar_k8s:: { incident, Error } ;
2322
2423#[ tokio:: main]
25- async fn main ( ) -> Result < ( ) , Error > {
26- // rustls 0.23 requires an explicit crypto provider when aws-lc-rs/ring are
27- // not auto-selected via default features (common with kube/reqwest stacks).
28- rustls :: crypto :: ring :: default_provider ( )
29- . install_default ( )
30- . expect ( "failed to install rustls ring CryptoProvider" ) ;
24+ async fn main ( ) {
25+ if let Err ( e ) = run ( ) . await {
26+ eprintln ! ( "Error: {e}" ) ;
27+ std :: process :: exit ( e . exit_code ( ) ) ;
28+ }
29+ }
3130
31+ async fn run ( ) -> Result < ( ) , Error > {
3232 let args = Args :: parse ( ) ;
3333
3434 let offline = args. offline ;
@@ -111,8 +111,7 @@ async fn main() -> Result<(), Error> {
111111 }
112112 Commands :: Run ( run_args) => {
113113 if let Err ( e) = run_args. validate ( ) {
114- eprintln ! ( "error: {e}" ) ;
115- process:: exit ( 2 ) ;
114+ return Err ( Error :: validation_step ( "run args" , e) ) ;
116115 }
117116 return run_operator ( run_args) . await ;
118117 }
0 commit comments