question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Warning for `error.code` is deprecated, use `error.status`

See original GitHub issue

Bug Report

Current Behavior

In @octokit/rest we’re seeing a deprecation warning for error.code:

`error.code` is deprecated, use `error.status`

This is from here, in Context#config:

https://github.com/probot/probot/blob/99784f3607dd9d4e4681b12a673757a9ac30b3b8/src/context.ts#L176-L178

It’s not a super-simple fix, because change it here causes tests to fail without the tests being updated - and that causes TypeScript errors:

image

So we’ll have to update the types as well.

@gr2m since we’re using our own types for the OctokitError class - what’s more correct here?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

6reactions
chrisdothtmlcommented, Aug 8, 2019

I’m still getting this on probot v9.2.20.

{ Deprecation: [@octokit/request] `error.code` is deprecated, use `error.status`.
    at HttpError.get (.../node_modules/@octokit/rest/node_modules/@octokit/request/lib/http-error.js:18:17)
    at Object.Logger.stdSerializers.err (.../node_modules/bunyan/lib/bunyan.js:1148:19)
    at .../node_modules/bunyan/lib/bunyan.js:873:50
    at Array.forEach (<anonymous>)
    at Logger._applySerializers (.../node_modules/bunyan/lib/bunyan.js:865:35)
    at mkRecord (.../node_modules/bunyan/lib/bunyan.js:978:17)
    at Logger.error (.../node_modules/bunyan/lib/bunyan.js:1044:19)
    at Application.<anonymous> (.../node_modules/probot/lib/application.js:159:33)
    at step (.../node_modules/probot/lib/application.js:43:23)
    at Object.throw (.../node_modules/probot/lib/application.js:24:53)
    at rejected (.../node_modules/probot/lib/application.js:16:65) name: 'Deprecation' }

Looks like it’s traced to the bunyan logging lib at lib/bunyan.js#L1146

1reaction
gr2mcommented, Mar 3, 2019

error.status is correct, it’s a number. It used to be the status text, that is a breaking change that comes with v8, so we should update it in probot

Read more comments on GitHub >

github_iconTop Results From Across the Web

Warning: expression closures are deprecated - MDN Web Docs
The JavaScript warning "expression closures are deprecated" occurs when the non-standard expression closure syntax (shorthand function syntax) ...
Read more >
node-express error : express deprecated res.send(status ...
You could try this: res.status(200).send((results[0].id).toString());. Guys are right - it doesn't allow numbers.
Read more >
Fix Your Craft CMS Deprecation Errors - CraftQuest
The first method is to use the Deprecation Warnings utlitiy in the Craft control panel. This gives you a historical view of all...
Read more >
A new mode `Warning[:deprecated] = :error` for 2.7 - Ruby ...
Warning [:deprecated] = :error , to make the warning into an error which produces a full backtrace (and stops the execution). Warning[:deprecated] =...
Read more >
Swift is flagging the use of deprecated functions as errors
The ns_deprecated bits refer mostly to things that were deprecated in the various OS verisons rather than our client code. The "Treat Warnings...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found