Skip to content

implement#258

Open
romanazhniuk wants to merge 1 commit intomate-academy:mainfrom
romanazhniuk:develop
Open

implement#258
romanazhniuk wants to merge 1 commit intomate-academy:mainfrom
romanazhniuk:develop

Conversation

@romanazhniuk
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.

Review Summary

Excellent work on this pull request! The email notification system is well-implemented, and the profile schemas are perfect. I am approving this to help you progress, but I have one suggestion for improvement.

In src/routes/profiles.py, the try...except Exception: blocks for token validation and avatar upload are too broad. This can hide different kinds of errors under a single message, making debugging harder. It's better practice to catch more specific exceptions, like JWT-related errors for token validation and the StorageError you've imported for file uploads.

This is a minor point in an otherwise fantastic submission. Keep up the great work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

# 1) Token validation (expired/invalid)
try:
payload = jwt.decode_access_token(token) # <-- звір назву у своєму JWTAuthManager
except Exception:

Choose a reason for hiding this comment

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

Using a generic except Exception: can hide different kinds of token errors (like an invalid signature or a malformed token) under a single "Token has expired." message. It's better practice to catch more specific exceptions from your JWT library to provide more accurate error details to the client.

# або put_object(bucket, key, bytes, content_type)->None + get_url(key)->str
avatar_url = s3_client.upload_file(avatar, key) # <-- підлаштуй під свій інтерфейс

except Exception:

Choose a reason for hiding this comment

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

This except Exception: is very broad and could catch errors that are not related to the file upload itself. Consider catching a more specific exception from the storage client, like the StorageError you've imported on line 17. This ensures that only storage-related issues are reported as an upload failure.

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