max-mapper / max-mapper/github-oauth

Consistent error handling

Open
#10 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
71
Forks
20
PR merge metrics
No merged PRs in 30d

Description

Hi! What do you think about changing https://github.com/maxogden/github-oauth/blob/master/index.js#L45 from

if (!code) return emitter.emit('error', {error: 'missing oauth code'}, resp)

to something like this:

if (!code) {
  var err = {error: 'missing oauth code'}
  if (cb) {
    cb(err)
  }
  return emitter.emit('error', err, resp)
}

because now if I rely on a callback that is the case when my callback won't be triggered.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at index.js#L45 and trace how the OAuth error path handles callbacks and emits errors. Done means a provided callback receives the missing OAuth code error while the error event continues to be emitted with the response.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
authentication, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.