Skip to content
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

Avoid crash if not provide book_name #431

Merged
merged 1 commit into from
Nov 6, 2024
Merged

Conversation

xyb
Copy link
Contributor

@xyb xyb commented Nov 6, 2024

Instead of showing an ugly crash message like the one below to the user when they don't provide any arguments, it would be better to display a more user-friendly message:

❯ bbook_maker
Traceback (most recent call last):
  File "/Users/xyb/.virtualenvs/bilingual_book_maker/bin/bbook_maker", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/xyb/projects/bilingual_book_maker/book_maker/cli.py", line 328, in main
    if not os.path.isfile(options.book_name):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen genericpath>", line 30, in isfile
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

A more appropriate message would be:

❯ bbook_maker
Error: please provide the path of your book using --book_name <path>

@yihong0618
Copy link
Owner

Nice catch thanks

@yihong0618 yihong0618 merged commit 546fbd8 into yihong0618:main Nov 6, 2024
2 checks passed
@xyb xyb deleted the default branch November 6, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants