Ambiguous 401 error message when apm calls unpublish


#1

I got 401 “Unauthorized” when I unpublish my own package.
This is because I renamed github repository name.
You may authorize by github repository ownership?
After that, I renamed the repo name to old name, then this problem was solved :wink:

But, I think I spent more than necessary time because of ambiguous error message.


The token is already regenerated.


Related apm code:
https://github.com/atom/apm/blob/master/src/unpublish.coffee

      request.del options, (error, response, body={}) =>
        if error?
          @logFailure()
          callback(error)
        else if response.statusCode isnt 204
          @logFailure()
          message = body.message ? body.error ? body
          callback("Unpublishing failed: #{message}")
        else
          @logSuccess()
          callback()

I think this is not apm problem, but atom REST api.
You should returns more friendly error message, I think. :smiley:

e.g.)
“Unauhorized. Do you have ownership of the package repository?”

Thanks.