I am utterly unable to control how exceptions are handled in my
application and it's driving me nuts

The idea is simple. I have  a SOAP handler like this.

class RtiController < ApplicationController

  begin
     wsdl_service_name 'Rti'
     web_service_scaffold :invoke
     web_service_api RtiApi

     before_invocation :authenticate

     include SoapMethods

     protected

     def authenticate (name, args)
        #the first two arguments are always username and password
        generic_login(args[0], args[1])
        unless logged_in?
           raise  Exceptions::LoginFailedError , "LoginFailedError:
Invalid user name or password"
        end
     end

  rescue Exception => e
     n = e.exception "#{e.inspect}: #{e.message}"
     n.set_backtrace []
     raise n
  end
end

Simple right?

If any error gets raised either in the authenticate function or any of
the functions in the included module I want to catch them and re-raise
a new error.

The rescue block never gets called no matter where the error happens.

Next I try this.

def rescue_action
 do the same thing above
end

Nope it never gets called either.

So I try this

 rescue_from  Exception do |e|
        n = e.exception "#{e.inspect}: #{e.message}"
       n.set_backtrace []
       raise n
 end

I also tried rescue_from SomeSpecificException  and that doesn't work either.

I also tried putting a begin rescue block in the included module and
that doesn't do anything either.

Why is this so complicated? I just want a  error handler for
this controller.  Is actionwebservice messing with the controller or
what?

P.S. I am using the datanoise actionwebservice.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to