lib/vmc/cli/start/target.rb in vmc-0.5.0.rc4 vs lib/vmc/cli/start/target.rb in vmc-0.5.0
- old
+ new
@@ -20,10 +20,17 @@
end
if input.has?(:url)
target = sane_target_url(input[:url])
with_progress("Setting target to #{c(target, :name)}") do
- CFoundry::Client.new(target) # check that it's valid before setting
+ begin
+ CFoundry::Client.new(target) # check that it's valid before setting
+ rescue CFoundry::TargetRefused
+ fail "Target refused connection."
+ rescue CFoundry::InvalidTarget
+ fail "Invalid target URI."
+ end
+
set_target(target)
end
end
return unless v2? && client.logged_in?