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

Improve Error Handling and Connection Management in profile.js #323

Open
smog-root opened this issue Oct 28, 2024 · 0 comments
Open

Improve Error Handling and Connection Management in profile.js #323

smog-root opened this issue Oct 28, 2024 · 0 comments
Assignees
Labels
gssoc-ext This issue is under GSSoc Ext program hacktoberfest This issue belongs to hacktoberfest level2 level2 lebel for gssoc level

Comments

@smog-root
Copy link
Contributor

smog-root commented Oct 28, 2024

Enhance the error handling, connection management, and query robustness in profile.js for improved reliability and maintainability.

Kindly add gssoc-ext with level and hacktoberfest-accepted labels! @Harshdev098!

1. Error Handling in display Function:

  • Check if result is empty before accessing result[0] properties to avoid potential undefined errors.
  • Solution: Add a check for an empty result and return a 404 Not Found response if no user data is found.

2. Error Handling in updateProfile:

  • Wrap db.query in a promise to fully support asynchronous execution using await, improving compatibility with future refactoring.

3. Token Logging:

  • Remove or mask sensitive information from any logging involving tokens, especially for production environments.

4. Optimize SQL Query Syntax:

  • Consider switching from INNER JOIN to LEFT JOIN to include users without entries in info_table, if applicable.

5. Connection Release in display:

  • Use a try...finally block to ensure connection.release() is called, even if an error occurs, preventing potential connection leaks.
@Harshdev098 Harshdev098 added hacktoberfest This issue belongs to hacktoberfest gssoc-ext This issue is under GSSoc Ext program level2 level2 lebel for gssoc level labels Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gssoc-ext This issue is under GSSoc Ext program hacktoberfest This issue belongs to hacktoberfest level2 level2 lebel for gssoc level
Projects
None yet
Development

No branches or pull requests

2 participants