[yast-devel] Re: [yast-commit] <rest-service> master : returning 400 and the missed arguments
Stefan Schubert write:
ref: refs/heads/master commit df9763bc3ec86997021c9fd0f9b016b86cc6ab4f Author: Stefan Schubert <schubi@suse.de> Date: Thu Oct 22 14:47:07 2009 +0200
returning 400 and the missed arguments --- .../registration/registration_controller.rb | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/plugins/registration/app/controllers/registration/registration_controlle r.rb b/plugins/registration/app/controllers/registration/registration_controlle r.rb index bd915e1..9427aae 100644 --- a/plugins/registration/app/controllers/registration/registration_controlle r.rb +++ b/plugins/registration/app/controllers/registration/registration_controlle r.rb @@ -22,9 +22,11 @@ class Registration::RegistrationController < ApplicationController end
ret = @register.register - #if (ret != 0) - # headers["Status"] = "400 Bad Request" - #end + if ret == "4" + render :xml=>@register.to_xml( :root => "registration", :dasherize => false ), :status =>400 and return + elseif ret != 0 + render ErrorResult.error(404, 2, "Error while calling registration server.") and return + end end
def show
Hi, If you use special code for communication it is OK, but when you want report error I suggest use BackendException. It is common way how we report errors on backend side and it has well defined structure which is easy to parse. see http://www.suse.de/~jreidinger/webservice/webservice/classes/BackendExceptio... (I should improve documentation of that class) and as example http://www.suse.de/~jreidinger/webservice/webservice/classes/NoPermissionExc... (especially source code of to_xml method) -- Josef Reidinger YaST team maintainer of perl-Bootloader, YaST2-Repair, webyast modules language and time -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (1)
-
Josef Reidinger