Skip to content

Fix/error handling in user controller.js #2772

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

Conversation

Mubashirshariq
Copy link
Contributor

Fixes #2762

Changes:
Used promises to handle the asynchronous operation and use async/await for better readability.
Used try-catch blocks to catch any errors that occur during the operation and handle them gracefully.

@lindapaiste
Copy link
Collaborator

The changes to the function look good. You’ve changed the signature of the function so that it no longer accepts a callback as an argument. So you need to make sure that you have updated all the places where this function is used so that the work with an async/promise call instead of passing a callback.

@BrawlerXull
Copy link

Please assigned this issue to me @lindapaiste as i have opened the issue and not @Mubashirshariq

@Mubashirshariq
Copy link
Contributor Author

Mubashirshariq commented Dec 25, 2023

@lindapaiste i have deleted the the findUserbyUsername function used directly findbyusername in aws_controller.js and added some neccessary checks

@BrawlerXull
Copy link

Neither @Mubashirshariq , nor @BrawlerXull have worked on it , basically the solution to the error was given by an Indian youtuber in one of his video after which many people including me are trying to fix that error . @lindapaiste

So what?

@BrawlerXull
Copy link

BrawlerXull commented Dec 25, 2023

Nothing. Keep working on it .I just mentioned that one in sarcasm. You people are working hard but why to fight like this ? This is my first PR so assign me and all . It's on her to choose. So, work is only in your hands.

On Mon, 25 Dec 2023, 15:02 BrawlerXull, @.> wrote: Neither @Mubashirshariq https://github.com/Mubashirshariq , nor @BrawlerXull https://github.com/BrawlerXull have worked on it , basically the solution to the error was given by an Indian youtuber in one of his video after which many people including me are trying to fix that error . @lindapaiste https://github.com/lindapaiste So what? — Reply to this email directly, view it on GitHub <#2772 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/BBVWDJPPM4L7BLQ7E5AGZNTYLFBZXAVCNFSM6AAAAABBBWP6KOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRYHA4DOMZQGE . You are receiving this because you commented.Message ID: <processing/p5. @.>

Please check your facts when u say the solution is provided by an 'Indian youtuber'
Check if my solution proposed in the snippet section of issue #2762 matches with the solution proposed by the Youtuber
I suggest you to use your words wisely

@lindapaiste
Copy link
Collaborator

I don't know why there's drama. It's really not necessary. Open source code is a communal effort where we all build off of each other's code and ideas. It is not a competition.

When I looked at this a few days ago there were 3 PRs but none of them solved the issue completely. At that time I went and assigned the issue to @BrawlerXull as they had opened the issue and it was still unresolved. Since then @Mubashirshariq revised their PR and changed their approach. It looks a lot better now, as we are returning proper descriptive API errors when encountering problems. I still need to run the code and make sure it works properly at run-time but the code looks right so I'm considering it "solved".

Copy link
Collaborator

@lindapaiste lindapaiste left a comment

Choose a reason for hiding this comment

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

Looks great, I love that you ate using different error codes depending on what the problem is.

@lindapaiste lindapaiste merged commit 45c2ce1 into processing:develop Jan 4, 2024
@raclim raclim added this to the MINOR Release for 2.11.0 milestone Jan 12, 2024
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.

Error not handled correctly in server/controllers/user.controller.js
4 participants