Mailinglist Archive: yast-devel (163 mails)

< Previous Next >
Re: [yast-devel] WebYast: Error reporting in backend and how to use it in plugin
  • From: Josef Reidinger <jreidinger@xxxxxxx>
  • Date: Mon, 21 Sep 2009 13:25:00 +0200
  • Message-id: <200909211325.01009.jreidinger@xxxxxxx>
On Monday 21 September 2009 12:10:24 Martin Vidner wrote:
On Mon, Sep 21, 2009 at 11:35:46AM +0200, Josef Reidinger wrote:
Hi,
I done error reporting in backend based on exceptions (Universal
exceptions is in file exceptions in webservice/lib).

Thanks! Here comes the punishment ;-)

There is two type of error:
First is invalid or missing parameters. For this case exist
InvalidParameters exceptions. For example usage and details please see
documentation of this exceptions.

ENOURL!
http://git.opensuse.org/?p=projects/yast/rest-service.git;a=blob;f=webservi

ce/lib/exceptions.rb;h=6dca0f4370aea170706f015a2366bb4cf5ef7c3a;hb=HEAD#l28


I think documentation of webservice, you can generate it by rake doc:app ( I
hope hudson start building our documentation).

So as an example, which everyone will need to copy:
http://git.opensuse.org/?p=projects/yast/rest-service.git;a=commitdiff;h=b7
f10188520c38d9a48db7b9e42f497408c8cd44 root = params[:time]
if root == nil
- render ErrorResult.error(404, 2, "format or internal error") and
return + raise InvalidParameters.new [{:name => "Timezone", :error =>
"Missing"}] end

Why is it "Timezone" instead of "time"? AFAIK :name is supposed to
be the missing attribute, but here the entire record is missing.
Should it not be added to the "base"?

I don't enough experience with structure of error. Name is important for
frontend identification of error. I plan some testing and inform mailing list.


(And I don't like the need to specify an array explicitly, but I can
fix that later.)

I can fix it myself, good idea.

Also this break all modules which uses basicPluginTest, because it now expect
422 on empty update request. This is for your information, that behavior
change and you should also do it.

--
Josef Reidinger
YaST team
maintainer of perl-Bootloader, YaST2-Repair, webyast modules language and
time
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >