cli icon indicating copy to clipboard operation
cli copied to clipboard

Handle common errors

Open jfmengels opened this issue 9 years ago • 24 comments

  • [x] Could not find .all-contributorsrc file.
  • [x] projectOwner is not set in .all-contributorsrc file.
  • [x] projectName is not set in .all-contributorsrc file.
  • [ ] files was overriden in .all-contributorsrc file 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).

jfmengels avatar Mar 06 '16 22:03 jfmengels

(it is still beginner-friendly, just wanted the issue to be less polluted by too many labels ;) )

jfmengels avatar Mar 30 '16 19:03 jfmengels

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' }

boneskull avatar Jul 03 '16 21:07 boneskull

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.

fadc80 avatar Oct 14 '16 03:10 fadc80

Network error adding a contributor.

This should differentiate different types of network errors, I think, such as no connection and rate limiting.

jamesplease avatar Oct 19 '17 18:10 jamesplease

Can i take projectOwner error?

M-ZubairAhmed avatar Dec 26 '17 14:12 M-ZubairAhmed

Feel free!

kentcdodds avatar Dec 26 '17 16:12 kentcdodds

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?

M-ZubairAhmed avatar Dec 28 '17 03:12 M-ZubairAhmed

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

M-ZubairAhmed avatar Dec 28 '17 08:12 M-ZubairAhmed

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.

machour avatar Dec 28 '17 09:12 machour

No login when adding a contributor.

This means that contributor's github does not exists?

M-ZubairAhmed avatar May 30 '18 11:05 M-ZubairAhmed

I think so.

kentcdodds avatar May 30 '18 13:05 kentcdodds

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?

M-ZubairAhmed avatar Jun 07 '18 09:06 M-ZubairAhmed

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 avatar Jun 08 '18 19:06 kentcdodds

@kentcdodds oh ok makes sense. Let me give it a stab

M-ZubairAhmed avatar Jun 08 '18 23:06 M-ZubairAhmed

What's a good starting point for these error? I'd like to take one like * projectName.

erdahuja avatar Feb 22 '19 17:02 erdahuja

@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 avatar Feb 22 '19 19:02 Berkmann18

@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 avatar Feb 23 '19 06:02 erdahuja

@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

M-ZubairAhmed avatar Feb 23 '19 08:02 M-ZubairAhmed

@erdahuja You should be able to submit a PR, which you seem to have done.

Berkmann18 avatar Feb 23 '19 13:02 Berkmann18

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.

erdahuja avatar Feb 25 '19 05:02 erdahuja

Thanks for doing this! Updated description!

jakebolam avatar Feb 27 '19 00:02 jakebolam

@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>

M-ZubairAhmed avatar Feb 28 '19 07:02 M-ZubairAhmed

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.

jakebolam avatar Mar 05 '19 14:03 jakebolam

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 :")

LakshmiGayathri19 avatar Nov 12 '23 04:11 LakshmiGayathri19