kalekundert / byoc

MIT License
0 stars 0 forks source link

Generate log message from exception info #23

Closed kalekundert closed 2 years ago

kalekundert commented 3 years ago

Right now, when DictLayer encounters a KeyError, it silently ignores the key and includes a message in its log about it. This works in most cases, but is very confusing when the key is a callable that raises a KeyError due to a programming bug.

kalekundert commented 2 years ago

I can't just let KeyError propogate when raised by a callable key. Callable keys are allowed to raise KeyError to indicate that they couldn't find whatever they were looking for. I could make them raise something else, like NoValueFound, but that would complicate the common case where the callable basically just does a dictionary lookup.

I could add the stack trace to the log, but that would dramatically complicate the log in most cases. I don't think that's a good idea.

I'm going to close this for now. The problem is too rare, and the solutions are too complicated. Ultimately, the problem is that the key function is buggy. AppCLI is kinda hiding the bug, but really, the bug is that the function is telling AppCLI to do exactly that.