Compare commits
4 Commits
83d74c2b06
...
pkg/dev/ri
Author | SHA1 | Date | |
---|---|---|---|
56b1f12a4a | |||
f88bcef5c0 | |||
4fc3e74bbd | |||
5663b2768b |
@ -7,6 +7,7 @@ from typing import Callable, Optional, List
|
|||||||
from asyncpg import create_pool
|
from asyncpg import create_pool
|
||||||
from json import dumps, loads
|
from json import dumps, loads
|
||||||
from pkg_resources import iter_entry_points
|
from pkg_resources import iter_entry_points
|
||||||
|
from traceback import print_exc
|
||||||
import risotto
|
import risotto
|
||||||
from .utils import _
|
from .utils import _
|
||||||
from .error import RegistrationError
|
from .error import RegistrationError
|
||||||
@ -277,7 +278,7 @@ class RegisterDispatcher:
|
|||||||
try:
|
try:
|
||||||
self.injected_self[submodule_name] = module.Risotto(test)
|
self.injected_self[submodule_name] = module.Risotto(test)
|
||||||
except AttributeError as err:
|
except AttributeError as err:
|
||||||
raise RegistrationError(_(f'unable to register the module {submodule_name}, this module must have Risotto class'))
|
print(_(f'unable to register the module {submodule_name}, this module must have Risotto class'))
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
""" check if all messages have a function
|
""" check if all messages have a function
|
||||||
@ -319,7 +320,13 @@ class RegisterDispatcher:
|
|||||||
await log.info_msg(risotto_context,
|
await log.info_msg(risotto_context,
|
||||||
None,
|
None,
|
||||||
info_msg)
|
info_msg)
|
||||||
await module.on_join(risotto_context)
|
try:
|
||||||
|
await module.on_join(risotto_context)
|
||||||
|
except Exception as err:
|
||||||
|
if get_config()['global']['debug']:
|
||||||
|
print_exc()
|
||||||
|
msg = _(f'on_join returns an error in module {submodule_name}: {err}')
|
||||||
|
await log.error_msg(risotto_context, {}, msg)
|
||||||
|
|
||||||
async def load(self):
|
async def load(self):
|
||||||
# valid function's arguments
|
# valid function's arguments
|
||||||
|
Reference in New Issue
Block a user