mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-03 09:01:13 +03:00
Continue to call plugin callbacks if earlier one fails
This commit is contained in:
parent
ff54bd56fd
commit
c8ff0a9701
19
plug.py
19
plug.py
@ -189,11 +189,12 @@ def notify_journal_entry(cmdr, is_beta, system, station, entry, state):
|
|||||||
try:
|
try:
|
||||||
# Pass a copy of the journal entry in case the callee modifies it
|
# Pass a copy of the journal entry in case the callee modifies it
|
||||||
if journal_entry.func_code.co_argcount == 4:
|
if journal_entry.func_code.co_argcount == 4:
|
||||||
error = error or journal_entry(cmdr, system, station, dict(entry))
|
newerror = journal_entry(cmdr, system, station, dict(entry))
|
||||||
elif journal_entry.func_code.co_argcount == 5:
|
elif journal_entry.func_code.co_argcount == 5:
|
||||||
error = error or journal_entry(cmdr, system, station, dict(entry), dict(state))
|
newerror = journal_entry(cmdr, system, station, dict(entry), dict(state))
|
||||||
else:
|
else:
|
||||||
error = error or journal_entry(cmdr, is_beta, system, station, dict(entry), dict(state))
|
newerror = journal_entry(cmdr, is_beta, system, station, dict(entry), dict(state))
|
||||||
|
error = error or newerror
|
||||||
except:
|
except:
|
||||||
print_exc()
|
print_exc()
|
||||||
return error
|
return error
|
||||||
@ -203,8 +204,8 @@ def notify_interaction(cmdr, is_beta, entry):
|
|||||||
"""
|
"""
|
||||||
Send an interaction entry to each plugin.
|
Send an interaction entry to each plugin.
|
||||||
:param cmdr: The piloting Cmdr name
|
:param cmdr: The piloting Cmdr name
|
||||||
:param entry: The interaction entry as a dictionary
|
|
||||||
:param is_beta: whether the player is in a Beta universe.
|
:param is_beta: whether the player is in a Beta universe.
|
||||||
|
:param entry: The interaction entry as a dictionary
|
||||||
:return: Error message from the first plugin that returns one (if any)
|
:return: Error message from the first plugin that returns one (if any)
|
||||||
"""
|
"""
|
||||||
error = None
|
error = None
|
||||||
@ -214,9 +215,10 @@ def notify_interaction(cmdr, is_beta, entry):
|
|||||||
try:
|
try:
|
||||||
# Pass a copy of the interaction entry in case the callee modifies it
|
# Pass a copy of the interaction entry in case the callee modifies it
|
||||||
if interaction.func_code.co_argcount == 2:
|
if interaction.func_code.co_argcount == 2:
|
||||||
error = error or interaction(cmdr, dict(entry))
|
newerror = interaction(cmdr, dict(entry))
|
||||||
else:
|
else:
|
||||||
error = error or interaction(cmdr, is_beta, dict(entry))
|
newerror = interaction(cmdr, is_beta, dict(entry))
|
||||||
|
error = error or newerror
|
||||||
except:
|
except:
|
||||||
print_exc()
|
print_exc()
|
||||||
return error
|
return error
|
||||||
@ -256,9 +258,10 @@ def notify_newdata(data, is_beta):
|
|||||||
if cmdr_data:
|
if cmdr_data:
|
||||||
try:
|
try:
|
||||||
if cmdr_data.func_code.co_argcount == 1:
|
if cmdr_data.func_code.co_argcount == 1:
|
||||||
error = error or cmdr_data(data)
|
newerror = cmdr_data(data)
|
||||||
else:
|
else:
|
||||||
error = error or cmdr_data(data, is_beta)
|
newerror = cmdr_data(data, is_beta)
|
||||||
|
error = error or newerror
|
||||||
except:
|
except:
|
||||||
print_exc()
|
print_exc()
|
||||||
return error
|
return error
|
||||||
|
Loading…
x
Reference in New Issue
Block a user