-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecation messages #206
Comments
Hmm the error will go away once we release a breaking version. But if you like we could check if |
@gr2m How long do you think this deprecation error will be in place for? I don't think adding a check would help as the error code in my case is 401. The oclif framework is calling the |
I don't know. We will definitely have a breaking change coming this year
That would require a lot of changes in |
@gr2m What about an API within this package that I can call directly? Thinking something like: import {disableDeprecationMessages} from "@oktokit/error"
disableDeprecationMessages() |
no sorry, I won't add any code to When you do your check const shouldPrint = !(err.code === 'EEXIT'); maybe add a check above such as const isOctokitRequestError = err.name === 'HttpError' && "status" in err
const shouldPrint = !isOctokitRequestError && !(err.code === 'EEXIT'); |
The code you suggested won't work for me as the it is inside a module that I depend on and not code I maintain. Thanks for the feedback however. |
Found a way around this: /* Octokit monkey patch to silence un-fixable deprecation warnings */
import { Deprecation } from "deprecation";
const oldWarn = console.warn;
console.warn = (...args: any[]) => {
const isDeprecation = args.some((arg) => arg instanceof Deprecation);
if (isDeprecation) {
// Silence is golden.
return;
}
oldWarn.apply(console, args);
};
/* End of monkey patch */ |
@gr2m I npm installed'd yesterday, and keep getting these errors. This is among the first Google results. Any update as to how to get rid off these errors? |
Right above you: #206 (comment) |
That's still the only way? Guess I was wondering why the lib I installed yesterday throws so many notices already. I am just using request.js. And that seems like an odd user experience. Especially since nothing shows up in |
Next major release will get that cleaned up |
I guess that wasn't cleaned up in the "next major release" as I am still seeing this issue |
This upcoming major release, which is in the works actually removes the deprecated code. See #401 |
@wolfy1339 Do you want to reopen this ticket until it is fixed? 🫣 |
I am using a tool called oclif to build a CLI and this tool inspects errors that are thrown to see how they should be shown to the user. Unfortunately this is triggering some deprecation warnings from
request-error
.The code that is causing the deprecation is
const shouldPrint = !(err.code === 'EEXIT');
and the logged message isIs there anyway to avoid seeing these deprecation messages?
The text was updated successfully, but these errors were encountered: