octokit / octokit.js

The all-batteries-included GitHub SDK for Browsers, Node.js, and Deno.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG]: [@octokit/request-error] `error.code` is deprecated, use `error.status`.

shakibhasan09 opened this issue · comments

What happened?

Hi, whenever I get an error from github rest api. Octokit throw an error saying error.code is deprecated, use error.status.

Versions

"octokit": "^3.2.0",
"hono": "^4.2.3",
"bun":"^1.0.3"

Relevant log output

get() {
69 |         logOnceCode(
70 |           new import_deprecation.Deprecation(
71 |             "[@octokit/request-error] `error.code` is deprecated, use `error.status`."
72 |           )
73 |         );
                   ^
Deprecation: [@octokit/request-error] `error.code` is deprecated, use `error.status`.
      at get (/home/sakib/Projects/___/api/node_modules/@octokit/request-error/dist-node/index.js:73:15)
      at errorHandler (/home/sakib/Projects/____/api/node_modules/hono/dist/hono-base.js:21:45)
      at /home/sakib/Projects/____/api/node_modules/hono/dist/compose.js:45:14
      at asyncFunctionResume (native:1:1)
      at promiseReactionJobWithoutPromiseUnwrapAsyncContext (native:1:1)
      at promiseReactionJob (native:1:1)

41 |   constructor(message, statusCode, options) {
42 |     super(message);
43 |     if (Error.captureStackTrace) {
44 |       Error.captureStackTrace(this, this.constructor);
45 |     }
46 |     this.name = "HttpError";
        ^
HttpError: Bad credentials - https://docs.github.com/rest
 code: "401"

      at new RequestError (/home/sakib/Projects/____/api/node_modules/@octokit/request-error/dist-node/index.js:46:4)
      at /home/sakib/Projects/______/api/node_modules/@octokit/request/dist-node/index.js:187:47
      at asyncFunctionResume (native:1:1)
      at promiseReactionJobWithoutPromiseUnwrapAsyncContext (native:1:1)
      at promiseReactionJob (native:1:1)

Code of Conduct

  • I agree to follow this project's Code of Conduct

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

This is a known issue.
It will get fixed in the next major version.

There isn't anything to do in the meantime