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

Adding constants for the error messages that are passed as direct values #1035

Open
Manoramsharma opened this issue Feb 9, 2023 · 12 comments
Assignees
Labels
feature request parent Parent issue wip Work in Progress

Comments

@Manoramsharma
Copy link
Contributor

Manoramsharma commented Feb 9, 2023

Actually there are constant values that are already defined for the different values of error message/code/param that are then further used by importing the src/constants folder, in the particular file but there are still some errors for which we are using direct values of message/param/code instead of already assigning the constants then using the same.
For instance,

requestContext.translate("invalid.refreshToken"),
          code: "invalid.refreshToken",
          param: "refreshToken",
requestContext.translate("invalid.credentials"),
          code: "invalid.credentials",
          param: "credentials",

Describe the solution you'd like
As the solution to this given problem it is more likely to create constants named

INVALID_REFRESH_TOKEN="Invalid Refresh token", 
INVALID_REFRESH_TOKEN_MESSAGE="invalid.refreshToken",
INVALID_REFRESH_TOKEN_CODE="invalid.refreshToken"
INVALID_REFRESH_TOKEN_PARAM="credentials"
``` in the src/constants folder and then using them anywhere required.

**Approach to be followed (optional)**
Just add and export the constant values for the given error message/code/param in the src/constants folder.

@github-actions github-actions bot added invalid This doesn't seem right unapproved Unapproved for Pull Request labels Feb 9, 2023
@github-actions
Copy link

github-actions bot commented Feb 9, 2023

Congratulations on making your first Issue! 🎊 If you haven't already, check out our Contributing Guidelines and Issue Reporting Guidelines to ensure that you are following our guidelines for contributing and making issues.

@Manoramsharma
Copy link
Contributor Author

Hi @noman2002 @palisadoes requires review on this issue.If approved I would like to work on this.

@aashimawadhwa
Copy link
Member

There are other files also with same issue , I would also like to work on this issue .
@palisadoes @noman

@kb-0311
Copy link
Contributor

kb-0311 commented Feb 9, 2023

This is a great suggestion, this would give a more consistent approach to testing as previously it felt inconsistent while writing tests for catching errors with hardcoded -strings.

@palisadoes palisadoes removed invalid This doesn't seem right unapproved Unapproved for Pull Request labels Feb 9, 2023
@noman2002
Copy link
Member

@Manoramsharma is this issue only on specific files or whole project. if its on specific file please mention the file name.

@palisadoes
Copy link
Contributor

@Manoramsharma This should be done for the whole project so reduce the PR workload.

@noman2002
Copy link
Member

@Manoramsharma This should be done for the whole project so reduce the PR workload.

Create child issues for each directory, and let others work too. It will be easier to track.

@aashimawadhwa
Copy link
Member

@Manoramsharma This should be done for the whole project so reduce the PR workload.

Create child issues for each directory, and let others work too. It will be easier to track.

should I create the children issue?

@anshgoyalevil
Copy link
Contributor

@Manoramsharma This should be done for the whole project so reduce the PR workload.

Create child issues for each directory, and let others work too. It will be easier to track.

should I create the children issue?

I may help you with this task. Either you create child issues, or I may help you with that.

@palisadoes
Copy link
Contributor

@Manoramsharma This should be done for the whole project so reduce the PR workload.

Create child issues for each directory, and let others work too. It will be easier to track.

should I create the children issue?

@aashimawadhwa Please proceed

@kb-0311
Copy link
Contributor

kb-0311 commented Feb 9, 2023

I could help with children issues also

@Manoramsharma
Copy link
Contributor Author

@Manoramsharma is this issue only on specific files or whole project. if its on specific file please mention the file name.

No this will be done for the complete project.

@noman2002 noman2002 assigned palisadoes and unassigned Manoramsharma Feb 9, 2023
@palisadoes palisadoes added the wip Work in Progress label Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request parent Parent issue wip Work in Progress
Projects
None yet
Development

No branches or pull requests

6 participants