lib/sauce_whisk/jobs.rb in sauce_whisk-0.0.19 vs lib/sauce_whisk/jobs.rb in sauce_whisk-0.0.20

- old
+ new

@@ -29,11 +29,15 @@ change_status(job_id, false) end def self.save(job) fields_to_save = job.updated_fields.each_with_object(Hash.new) do |field, hsh| - hsh[field] = job.send(field.to_s) + if field == :custom_data + hsh[:'custom-data'] = job.send(field.to_s) + else + hsh[field] = job.send(field.to_s) + end end put job.id, fields_to_save.to_json end def self.fetch(job_id) @@ -68,11 +72,16 @@ def self.job_assets(job_id) assets = JSON.parse get "#{job_id}/assets" screenshots = assets["screenshots"] {"screenshot_urls" => screenshots} - rescue RestClient::BadRequest - raise SauceWhisk::JobNotComplete + rescue RestClient::BadRequest => e + SauceWhisk.logger.debug("Exception fetching assets: #{e}") + if (/Job hasn't finished running/.match e.response) + raise SauceWhisk::JobNotComplete + else + raise e + end end end class Job attr_writer :updated_fields