[yast-commit] <web-client> master : Handle mistype url graceful (bnc#542444)
ref: refs/heads/master commit 6abe117faca7ef1711554398326cc762ce521d27 Author: Klaus Kämpf <kkaempf@suse.de> Date: Sat Sep 26 15:08:18 2009 +0200 Handle mistype url graceful (bnc#542444) --- webclient/app/controllers/hosts_controller.rb | 4 ++++ webclient/app/controllers/sessions_controller.rb | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/webclient/app/controllers/hosts_controller.rb b/webclient/app/controllers/hosts_controller.rb index ce9f177..aa79c69 100644 --- a/webclient/app/controllers/hosts_controller.rb +++ b/webclient/app/controllers/hosts_controller.rb @@ -26,6 +26,10 @@ class HostsController < ApplicationController flash[:warning] = _("Make sure the host is up and that the YaST web service is running.") elsif error == "nohostid" flash[:notice] = _("Please select a host to connect to.") + elsif error == "ecantresolve" + host = Host.find(params[:hostid]) rescue nil + flash[:error] = _("The host '#{host.url}' cannot be found.") if host + flash[:warning] = _("Please double-check the host URL.") end end diff --git a/webclient/app/controllers/sessions_controller.rb b/webclient/app/controllers/sessions_controller.rb index 6302a3d..849213b 100644 --- a/webclient/app/controllers/sessions_controller.rb +++ b/webclient/app/controllers/sessions_controller.rb @@ -45,6 +45,7 @@ class SessionsController < ApplicationController # it will show the login form def create host = Host.find(params[:hostid]) rescue nil + puts "Host(#{params[:hostid]}): #{host.inspect}" # if the user or password is not there, then render the login form if host.nil? flash[:warning] = _("You need to specify the host") @@ -66,6 +67,9 @@ class SessionsController < ApplicationController rescue Errno::ECONNREFUSED => e redirect_to :controller => "hosts", :action => "index", :hostid => host.id, :error => "econnrefused" return + rescue SocketError => e + redirect_to :controller => "hosts", :action => "index", :hostid => host.id, :error => "ecantresolve" + return end # Now check if the authentication was successful -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
Klaus Kämpf