lib/vagrant-rimu/actions/terminate_instance.rb in vagrant-rimu-0.0.4 vs lib/vagrant-rimu/actions/terminate_instance.rb in vagrant-rimu-0.0.5
- old
+ new
@@ -14,11 +14,15 @@
def execute(env)
if env[:machine].id
env[:ui].info(I18n.t("vagrant_rimu.terminating"))
client = env[:rimu_api]
- client.servers.cancel(env[:machine].id.to_i)
- env[:machine].id = nil
+ begin
+ client.servers.cancel(env[:machine].id.to_i)
+ env[:machine].id = nil
+ rescue ::Rimu::RimuAPI::RimuRequestError, ::Rimu::RimuAPI::RimuResponseError => e
+ raise Errors::ApiError, {:stderr=>e}
+ end
end
@app.call(env)
end
end