talawa-api
talawa-api copied to clipboard
Adding constants for the error messages that are passed as direct values
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.
Congratulations on making your first Issue! :confetti_ball: 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.
Hi @noman2002 @palisadoes requires review on this issue.If approved I would like to work on this.
There are other files also with same issue , I would also like to work on this issue . @palisadoes @noman
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.
@Manoramsharma is this issue only on specific files or whole project. if its on specific file please mention the file name.
@Manoramsharma This should be done for the whole project so reduce the PR workload.
@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.
@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?
@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.
@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
I could help with children issues also
@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.
Can I work on this issue??