Mentorship-backend: Save error and success messages into an array and replace hardcoded text

Created on 26 Jul 2018  路  15Comments  路  Source: anitab-org/mentorship-backend

Description

As a developer,
I need hardcoded error messages to be saved in an array,
so that I can avoid bugs related to the usage of hardcoded strings and pay attention to the repeated messages.

On backend save common messages of error and HTTP codes on a JSON
Have an Array of messages instead of using all over the code hardcoded text

Find a way to avoid hardcoded messages, that can be duplicated, with small differences. Make this uniform?!

Acceptance Criteria

Update [Required]

  • [ ] Suggestion: Create arrays for both success and error messages joined to replace hardcoded text
  • [ ] Suggestion: Have an array for error codes as well to see clearly the meaning of the error codes
  • [ ] Fix tests accordingly

Definition of Done

  • [ ] All of the required items are completed.
  • [x] Approval by 1 mentor.

Estimation

5 hours

Coding Maintenance

All 15 comments

@systers/mentorship can anyone approve this using the @sys-bot command?

@sys-bot I approve.

... Am I not registered? D:

@sys-bot approve

Lord... Done!

Can I please work on this issue @systers/maintainers-mentorship-backend ?

@preeti98 yes you can work on this :)

@preeti98 are you still working on this? If not, I will make this available again, no problem at all :)

@isabelcosta it would be nice if someone else takes over this issue now. However, do I make a PR for the changes I had made?
Here is the comparison:
https://github.com/systers/mentorship-backend/compare/develop...preeti98:add-error-msgs.json

Thank you @preeti98 for your response 馃槃

No need to make a PR, since your work was still a bit incomplete, but your comparison is really handy, so someone else can continue your work!

Thank you for your work, I hope you learned something by working on this :)

@isabelcosta I would like to work on this issue. Can I be assigned to this Issue.

@isabelcosta Usage of arrays can make the performance slow. I suggest we should prefer dictionary with value as error message of key. For example, error message for invalid email can look like following in the dictionary.

{
"EMAILERROR": "invalid email",
}

I would like to work on this issue.
I think these are the files which need to be updated-
api/jwt_extension.py, api/mail_utils.py, api/resources/(user.py, admin.py), api/validations/user.py,
api/dao/( admin.py, mentorship_relation.py, task.py, user.py).
Even I think that using dictionaries can be a better option.

@ethicalrushi I'm already working on this issue and currently undergoing discussion with the mentors for the same.I suggest you to take another issue.

@ethicalrushi please choose another issue to work with since @CleverFool77 had already started working on this and started a discussion on slack.

Was this page helpful?
0 / 5 - 0 ratings