Handle common errors
- [x] Could not find
.all-contributorsrcfile. - [x]
projectOwneris not set in.all-contributorsrcfile. - [x]
projectNameis not set in.all-contributorsrcfile. - [ ]
fileswas overriden in.all-contributorsrcfile and is empty. - [ ] Could not find some of the files to inject into. If adding a contributor, the addition should still take place.
- [ ] Could not find any injection tags. If adding a contributor, the addition should still take place.
- [x] No login when adding a contributor.
- [ ] No contribution types when adding a contributor.
- [x] Login not found when adding a contributor.
- [ ] Network error adding a contributor.
- [ ] Contribution type not found.
In all of these cases: Should print some helpful error and exit.
If you wish to contribute, first off: thanks! Feel free to tackle one or a few of these problems, no need to do them all (considering the number of them, I'd actually prefer multiple PRs).
(it is still beginner-friendly, just wanted the issue to be less polluted by too many labels ;) )
Could not find some of the files to inject into. If adding a contributor, the addition should still take place.
fwiw, having this one:
$ node_modules/.bin/all-contributors init
? What's the name of the repository? mocha
? Who is the owner of the repository? mochajs
? In which file should contributors be listed? CONTRIBUTORS.md
? Do you want a badge tallying the number of contributors? Yes
? In which file should the badge be shown? README.md
? How big should the avatars be? (in px) 100
? Do you want this badge to auto-commit when contributors are added? Yes
{ Error: ENOENT: no such file or directory, open 'CONTRIBUTORS.md'
at Error (native)
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: 'CONTRIBUTORS.md' }
Considering your first item.
Could not find .all-contributorsrc file.
Do you expect the following code snnipet from cli.js to be changed too?
try {
fs.statSync(argv.config);
} catch (error) { // No config file --> first time using the command
return cb('init');
}
I mean, if .all-contributorsrc file doesn't exist, then the init command will not be run by default anymore. Instead, an error message will be shown.
I ask because this code appears to ensure that the file will always exist.
Network error adding a contributor.
This should differentiate different types of network errors, I think, such as no connection and rate limiting.
Can i take projectOwner error?
Feel free!
can someone explain me these two points
Could not find some of the files to inject into. If adding a contributor, the addition should still take place. Could not find any injection tags. If adding a contributor, the addition should still take place.
- What exactly is some files ?
- What is injection tag?
Sorry for bugging out guys . I just have free time at work these days, so though i should contribute to open source during my day job till my project starts
Hey @M-ZubairAhmed, no worries, but don't forget that we're on different timezones + we all got things to do outside OSS :)
some files: The files where the markdown is generated (README.md in this repo), but other files can be specified in the files entry of config.
injection tag: In order for the lib to know WHERE in the given files (some files) it should inject the generated markdown file, we have a HTML comments like this: <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> and <!-- ALL-CONTRIBUTORS-LIST:END -->. These are referred to as injection tags.
No login when adding a contributor.
This means that contributor's github does not exists?
I think so.
Login not found when adding a contributor.
No login when adding a contributor.
Do they both mean the same, github username of the contributor being added not found?
Login not found when adding a contributor.
This would happen if I specify a contributor login and that user isn't found.
No login when adding a contributor.
This would happen if I'm trying to add a contributor but don't specify a login.
I think....
@kentcdodds oh ok makes sense. Let me give it a stab
What's a good starting point for these error? I'd like to take one like * projectName.
@erdahuja Well, have a look at how these errors are currently handled and see if you can improve them in a way that (as @jfmengels said in the OP) it shows a helpful and meaningful error and that it does the appropriate action (e.g: exit or/and fixing).
@Berkmann18 @kentcdodds i am unable add PR for it. i have done two check list points. Can you please consider adding me as a user? Or a PR from fork would work.
@erdahuja projectName and projectOwner is already done and merged at https://github.com/all-contributors/all-contributors-cli/pull/80 @jfmengels can you please edit the https://github.com/all-contributors/all-contributors-cli/issues/6#issue-138846112 to update whats done
@erdahuja You should be able to submit a PR, which you seem to have done.
Update:
Login not found when adding a contributor.
No login when adding a contributor.
PR for these is submitted. Next I am doing :
Contribution type not found.
@jfmengels Please update the checklist comment.
Thanks for doing this! Updated description!
@jakebolam can i take this one
No contribution types when adding a contributor
Just to be sure this means that when adding a collaborator, type of collaboration is not specified ?
for eg all-contributors add <username>
For sure @M-ZubairAhmed. Thank you!
Yes that is correct, if the user doesn't specify contribution types or invalid ones, then throw a meaningful error.
Hello, I am new to contributing to open source and would like to contribute to this project. I would like to take up the task "Contribution type not found". Could you please assign this task to me ? Thanks in advance :")