-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
feat: Add customizable log level for 'username already exists' error #9336
base: alpha
Are you sure you want to change the base?
Conversation
Thanks for opening this pull request! |
Thanks for the suggestions. I have made the changes according to the suggestions. @mtrezza Please have a look and tell if anything else needs to be changed |
@mtrezza I do not have a indepth knowledge of testing, earlier when you merged alpha branch into this branch, some tests were failing.I am eager to learn, and sorry if this question sounds dumb but could I know why? |
That is because with your previous commits, the CI never ran fully. If you click on the red "X" beside your commits, you can see that only 2 CI jobs ran. My merge started a full CI run. To make sure all tests pass locally you would run the full test suite locally with |
Hey @mtrezza thanks for explaining.I have modified the tests as you suggested.Please review it and let me know |
I have made the required changes.Please check |
Are there any more changes required? @mtrezza .Sorry for asking. |
I have refactored the test to make it more robust and concise. Observations:
|
Signed-off-by: Manuel <[email protected]>
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.
You requested a review but you did not push any new commit. Review feedback see #9336 (comment).
I believe while we create a user in RestWrite.js we already check for usernamealreadyexists and log it there so , no need of logging it again.Please check for the change I did. |
That may be right. Why is it throwing the specific error there then? Is that error internally caught? |
Why are the tests failing?I read the test error.Isn't this what we are supposed to do? |
If you run the test locally, does it pass? I assume this is only related to one of the log levels? |
Good catch in 386d2c1; let's see if the whole CI passes. |
Signed-off-by: Manuel <[email protected]>
Why is the CI failing even though the logic seems correct? |
I have refactored the test to make it easier to debug.
To debug the test easier, I have modified it to only run with The reason seems to be that the error is logged here: Lines 742 to 745 in 714acaa
None of the other 2 places where this PR currently places the log condition is called. It seems this is then passed up the chain and sent to the logger at some point in the code. I believe the solution is to find that point in code where it's sent to the logger, test for the error code (and maybe error text :-/ ) and put a condition there to log accordingly. |
I think just checking what type of log levels is there should solve the issue.Please merge to check again with CI |
Could you please run the test locally to see whether it passes? I doubt that this fixes it, because when I debugged the test, it didn't even run over these lines, see my comment above. Also, we probably shouldn't use this logic because there may be more or different logic level in the future. In fact, there is also a |
Could you help you here I am unable to find the error.Could you help you here?Thanks |
I am a bit stuck here.Could you help me out here?I am unable to understand where is this log of error is coming from. |
The tests are still failing.Is there anything I can do? |
This would need to be investigated; unfortunately I don't have the resources at the moment to support beyond the investigation I've posted above. |
Pull Request
Issue
#9329
Closes: #9329
Approach
So I have created a new interface
LogEventsOptions
interface insrc/Options/index.js
to incorporate the custom logEvents option in case of username already taken error.Then I have modified the RestWrite.js file to check for and apply the custom log level when a username already exists error occurs.I have also added documentation for the new option in
src/Options/docs.js
.I have also included a new test case in
spec/ParseUser.spec.js
to verify the functionality of the custom log level.If any changes are required , please inform me , I will do it.
Tasks