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 <connor@peet.io>

* fix lint error

---------

Co-authored-by: Connor Peet <connor@peet.io>
This commit is contained in:
Taiyo Sogawa
2023-06-19 13:16:29 -07:00
committed by GitHub
parent 0f8598bf46
commit ea97852a3b
2 changed files with 10 additions and 2 deletions

View File

@@ -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.

View File

@@ -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) => {