catch remote method exceptions
This commit is contained in:
parent
2b460a39fe
commit
dcedc99d23
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue