Skip to content

Commit fb9e948

Browse files
authored
Abort if no snapshot images were found (#11)
1 parent 04557dd commit fb9e948

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/commands/upload/snapshots/snapshots.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def call(image_paths:, **options)
4848

4949
start_time = Time.now
5050
run_id = nil
51+
success = false
5152

5253
begin
5354
api_token = @options[:api_token] || ENV['EMERGE_API_TOKEN']
@@ -76,12 +77,16 @@ def call(image_paths:, **options)
7677
Logger.info "Time taken: #{(Time.now - start_time).round(2)} seconds"
7778
@profiler.report
7879
Logger.info "✅ View your snapshots at https://emergetools.com/snapshot/#{run_id}"
80+
success = true
7981
rescue StandardError => e
8082
Logger.error "CLI Error: #{e.message}"
8183
Sync { report_error(run_id, e.message, 'crash') } if run_id
84+
raise e # Re-raise the error to dry-cli
8285
ensure
8386
@network&.close
8487
end
88+
89+
success
8590
end
8691

8792
private
@@ -116,6 +121,7 @@ def create_client(image_paths)
116121

117122
def find_image_files(client)
118123
found_images = client.image_files
124+
raise 'No images found. Please check your image paths or project configuration.' if found_images.empty?
119125
Logger.info "Found #{found_images.size} images"
120126
found_images
121127
end

0 commit comments

Comments
 (0)