On Wed, Jun 24, 2009 at 5:13 AM, Michael Ochs <[email protected]> wrote:

> Great, everything works fine now! Sorry for my very late answer. I am
> working on this project only once a week.
>
> Another question: What do I have to do if I want to throw my own error
> codes? For example something like "no entries selected", if return is
> an empty dataset? Do I have to return those messages as
> JsonRpcError_ScriptError?
>

Absolutely not. In fact, JsonRpcError_ScriptError is only meaningful when
the Origin is set to JsonRpcError_Origin_Server, which is during the generic
part of the JSON RPC server code. When control is transferred to your RPC
methods, the origin in the provided Error object has been set to
JsonRpcError_Origin_Application.

If you plan on using "throw" from your RPC method, you'll be instantiating a
new JsonRpcError() object. The constructor for JsonRpcError has default
values for each of its three parameters: code, message, and origin. Most
typically you'll be providing only a code and a message. The origin will
default to JsonRpcError_Origin_Application. When the origin is Application,
it is entirely up to your RPC methods and your application what code you
use. You might, for example, want to:

...
define("ApplicationError_NoEntriesSelected", 42);
...

throw new JsonRpcError(ApplicationError_NoEntriesSelected, "No entries
selected");

which is equivalent to

throw new JsonRpcError(ApplicationError_NoEntriesSelected, "No entries
selected", JsonRpcError_Origin_Application);

Hope that helps.

Derrell
------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to