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

Solution #621

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Solution #621

wants to merge 3 commits into from

Conversation

serg121192
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a 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

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

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

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):

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.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a 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
Comment on lines 23 to 24
raise ValueError(f"Value must be in {self.max_amount}"
f" - {self.max_amount} range.")

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.

Copy link

@Dimosphen1 Dimosphen1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, well done!

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.

3 participants