Mailinglist Archive: yast-devel (163 mails)

< Previous Next >
Re: [yast-devel] WebYast: Error reporting in backend and how to use it in plugin
  • From: Martin Vidner <mvidner@xxxxxxx>
  • Date: Mon, 21 Sep 2009 12:10:24 +0200
  • Message-id: <20090921101024.GD6561@xxxxxxxxxxxxxxxxxx>
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=webservice/lib/exceptions.rb;h=6dca0f4370aea170706f015a2366bb4cf5ef7c3a;hb=HEAD#l28

So as an example, which everyone will need to copy:
http://git.opensuse.org/?p=projects/yast/rest-service.git;a=commitdiff;h=b7f10188520c38d9a48db7b9e42f497408c8cd44
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"?

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

--
Martin Vidner, YaST developer
http://en.opensuse.org/User:Mvidner

Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >
References