base16-builder-python
base16-builder-python copied to clipboard
distinguish between missing templates and schemes
When there's not template or scheme file, we get a general error saying not all resources present. Instead, it'd be nice if it reported what is missing. I suggest creating two children of LookupError and return a corresponding error. What do you think?
I'm ready to implement this.
Hello hello! Sorry for the late reply and thank you for the suggestion. We can definitely distinguish between those two error types, however I don't think it's necessary to subclass LookupError. Instead, I think it would be a good idea to clean up the error printing code so that error messages are just passed along together with the exception instance.
So instead of this
def something():
raise LookupError
try:
something()
except LookupError:
print("specific error message")
we should do this:
def something():
raise LookupError("specific error message")
try:
something()
except LookupError as exc:
print(exc.msg)
The err_print function should be adapted to this end as well. Would you be interested in implementing this as well? If it's a bit too far removed from what you had in mind, I'd gladly do it myself (might take a bit though).
Yes, this is a much better solution. I'll implement it. It just might take a while. I'll get back to you once I have something.