@@ -209,7 +209,9 @@ impl Bot {
209209 match self . database . get_price_history ( crypto_name, 30 ) {
210210 Ok ( history) => {
211211 if history. is_empty ( ) {
212- let _ = channel_id. say ( & ctx. http , "❌ No historical data available yet (waiting for data to be collected)" ) . await ;
212+ if let Err ( e) = channel_id. say ( & ctx. http , "❌ No historical data available yet (waiting for data to be collected)" ) . await {
213+ warn ! ( "Failed to send empty history message: {}" , e) ;
214+ }
213215 return Ok ( ( ) ) ;
214216 }
215217 match generate_price_chart ( & history, crypto_name) {
@@ -305,8 +307,10 @@ impl Bot {
305307 . or_else ( || all_prices. get ( "PAXG" ) ) ;
306308
307309 if let Some ( gold) = gold_price {
308- let ratio = gold / current_price;
309- conversion_prices. push ( format ! ( "Ratio: {:.2} (Au/Ag)" , ratio) ) ;
310+ if current_price > 0.0 {
311+ let ratio = gold / current_price;
312+ conversion_prices. push ( format ! ( "Ratio: {:.2} (Au/Ag)" , ratio) ) ;
313+ }
310314 }
311315 }
312316
@@ -722,7 +726,9 @@ impl EventHandler for Bot {
722726 lines. push ( "```" . to_string ( ) ) ;
723727
724728 let message = lines. join ( "\n " ) ;
725- let _ = msg. channel_id . say ( & ctx. http , message) . await ;
729+ if let Err ( e) = msg. channel_id . say ( & ctx. http , message) . await {
730+ warn ! ( "Failed to send health status message: {}" , e) ;
731+ }
726732 self . health . update_discord_timestamp ( ) ;
727733 } else {
728734 debug ! (
@@ -775,7 +781,10 @@ async fn read_prices_from_file() -> BotResult<PricesFile> {
775781 }
776782 }
777783
778- unreachable ! ( )
784+ Err ( BotError :: Io ( std:: io:: Error :: new (
785+ std:: io:: ErrorKind :: Other ,
786+ "Unexpected error in prices file read retry loop" ,
787+ ) ) )
779788}
780789
781790/// Main price update loop with comprehensive error handling
@@ -1125,7 +1134,11 @@ fn format_custom_status(
11251134 . map ( |p| p. price ) ;
11261135
11271136 let ratio_str = if let Some ( gold) = gold_price {
1128- format ! ( "Au/Ag: {:.2}" , gold / current_price)
1137+ if current_price > 0.0 {
1138+ format ! ( "Au/Ag: {:.2}" , gold / current_price)
1139+ } else {
1140+ format ! ( "{:.8} ₿" , btc_amount)
1141+ }
11291142 } else {
11301143 format ! ( "{:.8} ₿" , btc_amount) // Fallback
11311144 } ;
@@ -1395,7 +1408,10 @@ async fn get_individual_crypto_price(feed_id: &str) -> BotResult<f64> {
13951408 }
13961409 }
13971410
1398- unreachable ! ( )
1411+ Err ( BotError :: Io ( std:: io:: Error :: new (
1412+ std:: io:: ErrorKind :: Other ,
1413+ "Unexpected error in prices file read retry loop" ,
1414+ ) ) )
13991415}
14001416
14011417/// Test Discord connectivity by making a simple API call
0 commit comments