From fb9e9483e702f233bed09e85cbfad20edd77cdc5 Mon Sep 17 00:00:00 2001 From: Trevor Elkins Date: Wed, 20 Nov 2024 18:29:10 -0500 Subject: [PATCH] Abort if no snapshot images were found (#11) --- lib/commands/upload/snapshots/snapshots.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/commands/upload/snapshots/snapshots.rb b/lib/commands/upload/snapshots/snapshots.rb index d4427d2..61038f7 100644 --- a/lib/commands/upload/snapshots/snapshots.rb +++ b/lib/commands/upload/snapshots/snapshots.rb @@ -48,6 +48,7 @@ def call(image_paths:, **options) start_time = Time.now run_id = nil + success = false begin api_token = @options[:api_token] || ENV['EMERGE_API_TOKEN'] @@ -76,12 +77,16 @@ def call(image_paths:, **options) Logger.info "Time taken: #{(Time.now - start_time).round(2)} seconds" @profiler.report Logger.info "✅ View your snapshots at https://emergetools.com/snapshot/#{run_id}" + success = true rescue StandardError => e Logger.error "CLI Error: #{e.message}" Sync { report_error(run_id, e.message, 'crash') } if run_id + raise e # Re-raise the error to dry-cli ensure @network&.close end + + success end private @@ -116,6 +121,7 @@ def create_client(image_paths) def find_image_files(client) found_images = client.image_files + raise 'No images found. Please check your image paths or project configuration.' if found_images.empty? Logger.info "Found #{found_images.size} images" found_images end