Loguru catch function parameters
Why does Loguru.logger.catch doesn't pass original function parameters to the wrapped function?
I think it does:
>>> from loguru import logger
>>> @logger.catch
... def add(a, b):
... return a + b
...
>>> add(1, 2)
3
Do you have an example where it's not the case?
I think it does:
>>> from loguru import logger >>> @logger.catch ... def add(a, b): ... return a + b ... >>> add(1, 2) 3Do you have an example where it's not the case?
Sorry, I mean to get access to parameters inside on_error function.
@david-shiko The onerror argument exists to help with error handling. If an unexpected error occurs, you may want to call sys.exit() with a different code based on error type for example. It's not meant for very advanced usages, if you need different behaviors based on function parameters, I would suggest to use a good old try / except block inside your function.
I'm closing the issue as it seems answered. Feel free to re-open it if you need more help.