Raising exceptions across DRb and XMLRPC

My architecture looks something like this. Please excuse the pitiful
ansi drawings.
(best viewed in fixed-width font)

   ------- -------
   > GUI | | GUI |
   ------- -------

···

           >

       > XMLRPC |
       > >
       > >
   --------------------------
   > NODE MANAGER |
   --------------------------
        > > >
        > DRB |
        > > >
        > > >
     ------ ------ ------
     >NODE> >NODE> >NODE>

I have GUIs that talk to a Node Manager that talks to Nodes.

Say, an error happens on a Node. How should I transmit that error
back across DRb and XMLRPC to the GUIs? Does XMLRPC do well with
exceptions? Should I come up with my own custom error-reporting
scheme?

Thanks,
Joe
     ------ ------ ------

Joe Van Dyk wrote:

Say, an error happens on a Node. How should I transmit that error
back across DRb and XMLRPC to the GUIs? Does XMLRPC do well with
exceptions? Should I come up with my own custom error-reporting
scheme?

It is no problem with DRb as it can safely transport exceptions across the network. No special casing is needed.

I'm not sure about XMLRPC.

Florian Groß wrote:

Joe Van Dyk wrote:

Say, an error happens on a Node. How should I transmit that error
back across DRb and XMLRPC to the GUIs? Does XMLRPC do well with
exceptions? Should I come up with my own custom error-reporting
scheme?

It is no problem with DRb as it can safely transport exceptions across the network. No special casing is needed.

I'm not sure about XMLRPC.

Pretty sure XML-RPC has a defined means for expressing exceptions, or faults:

http://www.xmlrpc.com/spec

James

···

--

http://www.ruby-doc.org - The Ruby Documentation Site
http://www.rubyxml.com - News, Articles, and Listings for Ruby & XML
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com - Playing with Better Toys

Hm, now all I have to do is figure out how to send a
XMLRPC::FaultException. Anyone have any example code?

···

On 9/27/05, James Britt <james_b@neurogami.com> wrote:

Florian Groß wrote:
> Joe Van Dyk wrote:
>
>> Say, an error happens on a Node. How should I transmit that error
>> back across DRb and XMLRPC to the GUIs? Does XMLRPC do well with
>> exceptions? Should I come up with my own custom error-reporting
>> scheme?
>
>
> It is no problem with DRb as it can safely transport exceptions across
> the network. No special casing is needed.
>
> I'm not sure about XMLRPC.

Pretty sure XML-RPC has a defined means for expressing exceptions, or
faults:

http://www.xmlrpc.com/spec

Yes, so it does.

My ClusterManager class needs to throw Exceptions. The ClusterManager
class doesn't really know anything about XMLRPC, as it's being wrapped
by a ClusterManagerServer class that starts the xmlrpc server and adds
a ClusterManager object to the xmlrpc server's handler.

Should the ClusterManager class throw XMLRPC excepts? Or plain Ruby ones?

···

On 9/27/05, James Britt <james_b@neurogami.com> wrote:

Florian Groß wrote:
> Joe Van Dyk wrote:
>
>> Say, an error happens on a Node. How should I transmit that error
>> back across DRb and XMLRPC to the GUIs? Does XMLRPC do well with
>> exceptions? Should I come up with my own custom error-reporting
>> scheme?
>
>
> It is no problem with DRb as it can safely transport exceptions across
> the network. No special casing is needed.
>
> I'm not sure about XMLRPC.

Pretty sure XML-RPC has a defined means for expressing exceptions, or
faults:

http://www.xmlrpc.com/spec

IIRC, just raise it like any old exception

def my_xmlrpc_method
   raise XMLRPC::FaultException.new(1, 'You got exception')
end

The first parameter is the fault code you want to send, the second is the fault string.

HTH,

···

On Sep 27, 2005, at 10:07 PM, Joe Van Dyk wrote:

Hm, now all I have to do is figure out how to send a
XMLRPC::FaultException. Anyone have any example code?

--
~akk

This is how I am using the XMLRPC::FaultException:

     class BlogAPIFault < StandardError
     end

     def mt_getCategoryList(blogid)
       result = @client.call('mt.getCategoryList', blogid, @username, @password)
     rescue XMLRPC::FaultException
       raise BlogAPIFault.new($!.faultString)
     end

This prints nice errors to stdout.

HTH-
-Ezra

···

On Oct 3, 2005, at 6:22 AM, Adam Keys wrote:

On Sep 27, 2005, at 10:07 PM, Joe Van Dyk wrote:

Hm, now all I have to do is figure out how to send a
XMLRPC::FaultException. Anyone have any example code?

IIRC, just raise it like any old exception

def my_xmlrpc_method
  raise XMLRPC::FaultException.new(1, 'You got exception')
end

The first parameter is the fault code you want to send, the second is the fault string.

HTH,
--
~akk
http://therealadam.com

-Ezra Zygmuntowicz
Yakima Herald-Republic
WebMaster

509-577-7732
ezra@yakima-herald.com