Skip to content

Commit

Permalink
Abort if no snapshot images were found (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
trevor-e authored Nov 20, 2024
1 parent 04557dd commit fb9e948
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/commands/upload/snapshots/snapshots.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fb9e948

Please sign in to comment.