-
Notifications
You must be signed in to change notification settings - Fork 620
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
Solution #621
base: master
Are you sure you want to change the base?
Solution #621
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like there are a few critical issues that need to be addressed before we can proceed. Specifically, the handling of exceptions and the use of the 'limitation_class' attribute need attention to ensure the code functions correctly and is maintainable. Please make these changes, and feel free to reach out if you need any help! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
app/main.py
Outdated
|
||
def __set__(self, instance: object, value: int) -> None: | ||
if not isinstance(value, int): | ||
raise TypeError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line raises a TypeError without a message. It's a good practice to provide a message explaining why the error is raised, for better debugging and understanding.
app/main.py
Outdated
if not isinstance(value, int): | ||
raise TypeError | ||
if not self.min_amount <= value <= self.max_amount: | ||
raise ValueError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line raises a ValueError without a message. Consider adding a message to explain why the value is invalid, which can help with debugging.
limitation_class: SlideLimitationValidator | ||
) -> None: | ||
self.name = name | ||
self.limitation_class = limitation_class |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'limitation_class' attribute is expected to be a class, but it is being used as an instance in the 'can_access' method. You should instantiate the limitation class here or modify the 'can_access' method to use it correctly.
visitor.height, | ||
visitor.weight | ||
) | ||
except (ValueError, TypeError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Catching exceptions without handling them or logging can make debugging difficult. Consider logging the exception or providing more context about the error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job on your progress! 🎉 While there is an issue with the error message repeating the maximum value instead of including both the minimum and maximum values, this decision is made to help you move forward with your learning. Please review the comments to improve your code. Remember, addressing such critical issues in the future will help you avoid similar problems. Keep up the good work and continue learning from your mistakes!
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
app/main.py
Outdated
raise ValueError(f"Value must be in {self.max_amount}" | ||
f" - {self.max_amount} range.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a mistake in the error message. It should include both the minimum and maximum values of the range. Currently, it repeats the maximum value twice. Consider changing the message to include both the minimum and maximum values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, well done!
No description provided.