-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Misleading error/exception thrown with invalid data . #147
Comments
I suggest a patch along these lines --- a/martor/utils.py
+++ b/martor/utils.py
@@ -33,7 +33,9 @@ def markdownify(markdown_content):
extensions=MARTOR_MARKDOWN_EXTENSIONS,
extension_configs=MARTOR_MARKDOWN_EXTENSION_CONFIGS
)
- except Exception:
+ except TypeError as e:
+ if 'extendMarkdown' not in str(e):
+ raise
raise VersionNotCompatible("The markdown isn't compatible, please reinstall "
"your python markdown into Markdown>=3.0")
|
@rgammans oh ok, nice one. can you please create new P.R? |
Ok, I can do this. Do I need to add a unit test? I feel I should but there doesn't seem to be very many in this project as it stands at the moment |
@rgammans no need unitest is no problem. |
rgammans
added a commit
to rgammans/django-markdown-editor
that referenced
this issue
Feb 18, 2021
This was referenced Feb 18, 2021
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When unexpected errors occur in the markdownify, or function which rely on it the martor.utils.VersionNotCompatible, exception
is thrown rather than propagating the original exception. I generally feel that pattern try-except in markdownify eg..
has too broad a 'catch' clause.
Can you consider narrowing the clause?
Details
Steps to reproduce
(minimal example)
pipenv install martor
pipenv run python test.py
The text was updated successfully, but these errors were encountered: