-
Notifications
You must be signed in to change notification settings - Fork 62
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
Cannot import BadRequestError from lib/errors #202
Comments
@okomarov This isn't a bug. The error is just node saying that you can't import it, since the @gadicc Is it possible to make the errors public? This pattern does seem to be what MDN recommends. |
Thanks for the quick reply! Feel free to change bug -> feature request or close. I was led to think I should be able to import them from the docs under Error Handling where it says "there are specific errors at..." |
I see the issue now. To solve this, you could switch over the import yf from 'yahoo-finance2';
try {
await yf.quote('AAPL');
} catch (err) {
if (err.name === "BadRequestError") {
// do something
}
// Check for more things...
} Again, this code has not been tested, so no guarantees. |
Thanks @okomarov for reporting and yes, @PythonCreator27, I agree that the errors should be public. Watch this space. |
I exposed the errors in You're welcome to check this out in a local |
# [1.13.0](v1.12.1...v1.13.0) (2021-06-06) ### Features * **errors:** expose in yf.errors; improve docs ([#202](#202)) ([a3a7da6](a3a7da6))
🎉 This feature is included in version 1.13.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Thanks, @okomarov! 🙏 |
Bug Report
Describe the bug
Can't import specific errors from the lib/errors
Minimal Reproduction
then running it with:
throws:
Environment
Node version (if applicable): 14.17.0
yarn version: 1.22.10
Library version (e.g.
1.10.1
): 1.12.1The text was updated successfully, but these errors were encountered: