catch remote method exceptions

This commit is contained in:
Dimitur Kirov 2005-07-20 17:51:31 +00:00
parent 2b460a39fe
commit dcedc99d23
1 changed files with 14 additions and 14 deletions

View File

@ -213,20 +213,20 @@ def gtk_quit():
# method(sys.argv[2:]) doesn't work, cos sys.argv[2:] is a tuple
def call_remote_method(method):
argv_len = len(sys.argv)
#~ try:
if argv_len == 2:
res = method()
elif argv_len == 3:
res = method(sys.argv[2])
elif argv_len == 4:
res = method(sys.argv[2], sys.argv[3])
elif argv_len == 5:
res = method(sys.argv[2], sys.argv[3], sys.argv[4])
elif argv_len == 6:
res = method(sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5])
return res
#~ except:
#~ send_error(_('Service not available'))
try:
if argv_len == 2:
res = method()
elif argv_len == 3:
res = method(sys.argv[2])
elif argv_len == 4:
res = method(sys.argv[2], sys.argv[3])
elif argv_len == 5:
res = method(sys.argv[2], sys.argv[3], sys.argv[4])
elif argv_len == 6:
res = method(sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5])
return res
except:
send_error(_('Service not available'))
return None