Add a little error handling

This commit is contained in:
ViViDboarder 2017-08-23 10:36:05 -07:00
parent 2e9bce3509
commit 37be12dee1

View File

@ -57,18 +57,22 @@ module AbuseTheForce
manifest = Metaforce::Manifest.new(metadata_type => [full_name]) manifest = Metaforce::Manifest.new(metadata_type => [full_name])
@client.retrieve_unpackaged(manifest). begin
extract_to(Atf_Config.get_project_path). @client.retrieve_unpackaged(manifest).
on_complete { |job| puts "Finished retrieve #{job.id}!" }. extract_to(Atf_Config.get_project_path).
on_error { |job| puts "Something bad happened!" }. on_complete { |job| puts "Finished retrieve #{job.id}!" }.
on_poll { |job| puts "Polling for #{job.id}!" }. on_error { |job| puts "Something bad happened!" }.
perform on_poll { |job| puts "Polling for #{job.id}!" }.
perform
# Restore old Manifest rescue
FileUtils.move( puts "An error ocurred."
File.join(Atf_Config.get_project_path, 'package.xml-bak'), ensure
File.join(Atf_Config.get_project_path, 'package.xml') # Restore old Manifest
) FileUtils.move(
File.join(Atf_Config.get_project_path, 'package.xml-bak'),
File.join(Atf_Config.get_project_path, 'package.xml')
)
end
end end
# Fetches a whole project from the server # Fetches a whole project from the server