[Maas-devel] Don't forget to catch declared exceptions in RPC handlers
Julian Edwards
julian.edwards at canonical.com
Fri Sep 19 02:03:46 UTC 2014
Hi all
I've noticed that there's a fair bit of code out there that is doing stuff
like this:
@asynchronous
@inlineCallbacks
def foo():
yield(SomeRPCFunction, arg)
DoSomethingElse()
Where SomeRPCFunction has declared in its definition an "errors" structure
which lists all the possible exceptions.
Please don't forget to catch these exceptions on the caller side! e.g.
@asynchronous
@inlineCallbacks
def foo():
try:
yield(SomeRPCFunction, arg)
except FooException:
log("aieeee")
else:
DoSomethingElse()
More information about the Maas-devel
mailing list