Throwing an AMF Error Gracefully

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Throwing an AMF Error Gracefully

Joel Hooks-2
I'm writing my own authorization mechanism and want to throw graceful errors on the client side. i'm extending BaseError, but was looking for an example of how this is done currently. I've dug through the code, but nothing stood out to me.

-joel




_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Throwing an AMF Error Gracefully

Nick Joyce
Raising an exception from within a PyAMF service method will cause the fault handler to be called on the flash/flex side. If using AMF3 then that will be an ErrorMessage. If the gateway has debug turned on then the Python stack trace will be included.

You can also use you're own exception classes:

class MyException(Exception):
     pass

def cause_error():
    raise MyException('some message here')

services = {
    'error' : cause_error
}

gw = WSGIGateway(services, expose_request=False)

etc.

Hth,

Nick

On 21 Nov 2009, at 16:07, Joel Hooks wrote:

I'm writing my own authorization mechanism and want to throw graceful errors on the client side. i'm extending BaseError, but was looking for an example of how this is done currently. I've dug through the code, but nothing stood out to me.

-joel




_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users


_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users