-
Notifications
You must be signed in to change notification settings - Fork 5
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
fix: created custom error when env var for providers does not exist or unknown provider, moderator is attempted to be loaded #69
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like progress
src/exchange/providers/base.py
Outdated
self.instructions = instructions | ||
self.message = f"Missing environment variable: {env_variable} for provider {provider}" | ||
if instructions: | ||
self.message += f". {instructions}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe rename instructions to instructions_url?
Also, not sure style, but if ok with multi-line error we could \n this and then make the asserts multi-line
self.message += f". {instructions}" | |
self.message += f". See {instructions} for instructions." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @codefromthecrypt for your feedback!
Yes, we can rename to instructions_url so that we will have consistent message pattern. On the other hand, I am thinking whether we shall have some flexibility for the instructions. For example, people can put instructions without url. It is hard to know the future :).
I'll change as you suggested, in case we want to have more flexibility, it is fine because the function signature won't change anyway.
Also I've added the error message for unknown configuration values and put the screenshot in block/goose#103. I would like to get your feedback too! Thank you!
moved the change to block/goose#103 |
Why
Currently it throws a runtime error and print the stack trace when
This make it hard for users to understand what is going.
What
provider
,env_variable
With the above custom erros we can construct user friendly messages in goose
How will it be used
The errors will be caught in
goose
. goose PRNote
This PR is for early feedback, and it won't be merged into this repo as @baxen is going to move this repo to
goose
. I will move the PR change togoose
accordingly afterwards