diff options
author | Mark Spruiell <mes@zeroc.com> | 2007-11-05 12:19:49 -0800 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2007-11-05 12:19:49 -0800 |
commit | 3c8924663df8629b33c2ddd38907c4bf2eeb83cd (patch) | |
tree | 83b63f2396201019163d140555e42d79f82e46d3 /py/test/Ice/servantLocator/TestI.py | |
parent | Merge branch 'master' of ssh://cvs.zeroc.com/home/git/ice (diff) | |
download | ice-3c8924663df8629b33c2ddd38907c4bf2eeb83cd.tar.bz2 ice-3c8924663df8629b33c2ddd38907c4bf2eeb83cd.tar.xz ice-3c8924663df8629b33c2ddd38907c4bf2eeb83cd.zip |
- Fixing bug 2522 for Python. This involved adding the C++ class
UserExceptionWriter so that the Python extension can wrap a native
Python user exception into something that the C++ run time can
marshal. Also ported the changes to the servantLocator test.
- Implementing UserExceptionWriter in Java and C#.
- Consolidating the source files for the C# streaming API.
Diffstat (limited to 'py/test/Ice/servantLocator/TestI.py')
-rw-r--r-- | py/test/Ice/servantLocator/TestI.py | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/py/test/Ice/servantLocator/TestI.py b/py/test/Ice/servantLocator/TestI.py index b79c7e9b337..52b367308ea 100644 --- a/py/test/Ice/servantLocator/TestI.py +++ b/py/test/Ice/servantLocator/TestI.py @@ -38,6 +38,27 @@ class TestI(Test.TestIntf): def pythonException(self, current=None): pass + def unknownExceptionWithServantException(self, current=None): + raise Ice.ObjectNotExistException() + + def impossibleException(self, throw, current=None): + if throw: + raise Test.TestImpossibleException() + # + # Return a value so we can be sure that the stream position + # is reset correctly if finished() throws. + # + return "Hello" + + def intfUserException(self, throw, current=None): + if throw: + raise Test.TestIntfUserException() + # + # Return a value so we can be sure that the stream position + # is reset correctly if finished() throws. + # + return "Hello" + def shutdown(self, current=None): current.adapter.deactivate() @@ -88,22 +109,20 @@ class ServantLocatorI(Ice.ServantLocator): if current.operation == "requestFailedException": raise Ice.ObjectNotExistException() elif current.operation == "unknownUserException": - ex = Ice.UnknownUserException() - ex.unknown = "reason" - raise ex + raise Ice.UnknownUserException("reason") elif current.operation == "unknownLocalException": - ex = Ice.UnknownLocalException() - ex.unknown = "reason" - raise ex + raise Ice.UnknownLocalException("reason") elif current.operation == "unknownException": - ex = Ice.UnknownException() - ex.unknown = "reason" - raise ex + raise Ice.UnknownException("reason") elif current.operation == "userException": raise Test.TestIntfUserException() elif current.operation == "localException": - ex = Ice.SocketException() - ex.error = 0 - raise ex + raise Ice.SocketException(0) elif current.operation == "pythonException": raise RuntimeError("message") + elif current.operation == "unknownExceptionWithServantException": + raise Ice.UnknownException("reason") + elif current.operation == "impossibleException": + raise Test.TestIntfUserException() # Yes, it really is meant to be TestIntfUserException. + elif current.operation == "intfUserException": + raise Test.TestImpossibleException() # Yes, it really is meant to be TestImpossibleException. |