From 1bd07b49c0c38dce3390f1683e7dc9838b511de5 Mon Sep 17 00:00:00 2001 From: Alberto Gimeno Date: Tue, 25 Jul 2023 10:04:59 +0200 Subject: [PATCH] Print file size if file too large (#440) --- src/commands/up.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/commands/up.rs b/src/commands/up.rs index d7b3ca079..55ebc104c 100644 --- a/src/commands/up.rs +++ b/src/commands/up.rs @@ -264,6 +264,14 @@ pub async fn command(args: Args, _json: bool) -> Result<()> { return Err(RailwayError::FailedToUpload(body.message).into()); } + if status == 413 { + let filesize = arc.lock().unwrap().len(); + return Err(RailwayError::FailedToUpload(format!( + "Failed to upload code. File too large ({} bytes)", + filesize + )))?; + } + return Err(RailwayError::FailedToUpload(format!( "Failed to upload code with status code {status}" ))