-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
More descriptive error for environment variable not found #6042
Conversation
While the error message is cleaner, its now not possible anymore to catch KeyErrors (or are they mapped to the same exception?). IMHO |
Thanks, that's the kind of thing I meant by "if this needs to be done differently." I don't know enough about exception handling to be sure how to do this properly. Would |
That will look funny when it prints like
|
Actually I am not an expert on Julia exceptions either but have worked a lot with exceptions in C++ and C#. And from this I know that it is pretty important to |
@ivarne: Are the exceptions defined in the C part of Julia? Maybe KeyError should only print |
Some exceptions is defined in C because of bootstrapping issues. The rest is defined in base/boot.jl. The printing of the exceptions is defined in base/repl.jl as methods on the |
Okay thanks. I find it a little bit confusing that the naming |
Agree that it looks funny. Maybe remove the duplication of "not found," just say |
I think the argument to |
That's perfectly reasonable. What about adding a subtype of |
If we had inheritance from concrete types, that would be the right approach. Currently the Julia exception system is not designed for the inheritance hierarchy, we know (and love) from Java and Python. |
I'll close this PR for now, until I figure out a better way to do what I'm going for. It seems like making an almost identical copy of @ivarne I don't particularly like anything about either of those languages but that's beside the point |
When
ERROR: key not found: "foo"
happens deep in some internal function, it's not always obvious that it's referring to an environment variable. Bikeshedding on the error message welcome (or if this needs to be done differently), but I think this is a special enough case that it should get a specific message.