From 6059e1362a7f91acdbc904c686ccf85f7e623044 Mon Sep 17 00:00:00 2001 From: zizou <111426680+flopell@users.noreply.github.com> Date: Tue, 7 Jan 2025 10:03:49 +0100 Subject: [PATCH] refactor(example): early error if `RPC_URL` isn't set in `price_printer` --- examples/price_printer/main.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/price_printer/main.rs b/examples/price_printer/main.rs index b7684ae4..4c6a033f 100644 --- a/examples/price_printer/main.rs +++ b/examples/price_printer/main.rs @@ -43,6 +43,11 @@ async fn main() { let tycho_api_key: String = env::var("TYCHO_API_KEY").unwrap_or_else(|_| "sampletoken".to_string()); + // Perform an early check to ensure `RPC_URL` is set. + // This prevents errors from occurring later during UI interactions. + // Can be commented out if only using the example with uniswap_v2 and uniswap_v3. + env::var("RPC_URL").expect("RPC_URL env variable should be set"); + // Create communication channels for inter-thread communication let (tick_tx, tick_rx) = mpsc::channel::(12);