-
-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Impossible to debug menu.py errors #44
Comments
Hi. Thanks for reporting this. I admit I've been bitten by this before too, so I'm happy to improve our error handling at import.
I will leverage the standard logging package and have it log a clear error along with a full traceback. PR incoming sometime today.
|
It appears the problem is not that you can't debug all problems when we import the menus, it's that you cannot debug other If I make a syntax error in the However, if I change it so there's a bad import:
Then the page loads and there's silently no accounts menu anymore. Since we also get an |
What if we filter the exceptions to find out where it's coming from? Something along the lines of: # https://github.com/jazzband/django-simple-menu/blob/21136c30d8dc064f5b587272012301694307c9d5/menu/menu.py#L66
try:
__import__(menu_module, fromlist=["menu", ])
except ImportError as err:
if err.name != menu_module:
raise ImportError from err This way, importing non-existent |
menu.py
importing has a catch all that hides all errors making you think the plugin is not working when your code is at faulthttps://github.com/borgstrom/django-simple-menu/blob/master/menu/menu.py#L75
My snippet:
The text was updated successfully, but these errors were encountered: