From ea97852a3ba7a5e1fd6c540b5f4c72a00fb8ca87 Mon Sep 17 00:00:00 2001 From: Taiyo Sogawa <1176981+taiyosogawa@users.noreply.github.com> Date: Mon, 19 Jun 2023 13:16:29 -0700 Subject: [PATCH] Add server message to user-facing error on 429 for tunnel creation (#185600) * Add server message to user-facing error on 429 for tunnel creation * Update cli/src/tunnels/dev_tunnels.rs Co-authored-by: Connor Peet * fix lint error --------- Co-authored-by: Connor Peet --- cli/src/commands/args.rs | 2 +- cli/src/tunnels/dev_tunnels.rs | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cli/src/commands/args.rs b/cli/src/commands/args.rs index 5d23bd634fb..ad961496bcc 100644 --- a/cli/src/commands/args.rs +++ b/cli/src/commands/args.rs @@ -611,7 +611,7 @@ pub enum TunnelSubcommand { /// Restarts any running tunnel on the system. Restart, - /// Gets whether there is a tunnel running on the current machineiou. + /// Gets whether there is a tunnel running on the current machine. Status, /// Rename the name of this machine associated with port forwarding service. diff --git a/cli/src/tunnels/dev_tunnels.rs b/cli/src/tunnels/dev_tunnels.rs index 45ba6f9860a..fa8d6cbbf20 100644 --- a/cli/src/tunnels/dev_tunnels.rs +++ b/cli/src/tunnels/dev_tunnels.rs @@ -471,9 +471,17 @@ impl DevTunnels { continue; } + if let Some(d) = e.get_details() { + let detail = d.detail.unwrap_or_else(|| "unknown".to_string()); + return Err(AnyError::from(TunnelCreationFailed( + name.to_string(), + detail, + ))); + } + return Err(AnyError::from(TunnelCreationFailed( name.to_string(), - "You've exceeded the 10 machine limit for the port fowarding service. Please remove other machines before trying to add this machine.".to_string(), + "You have exceeded a limit for the port fowarding service. Please remove other machines before trying to add this machine.".to_string(), ))); } Err(e) => {