Open acbart opened 1 year ago
This dovetails with error handling. What kind of errors do we have in Pedal?
The latter two kinds of errors should be raise
d, that seems clear enough. And I guess logged? Or one of the other? I need to think a bit more about what this should look like exactly. Can we think of some cases of actual errors?
It's confusing because usually catchable exceptions are because you know the user can get things into an invalid state. But what situations in Pedal allow the instructor to get things into a bad state? Let's think about each tool:
input
wrong?prevent_ast
).So many of Pedal's tools are unconditional executions. You just call them and let them work. That's a tricky part of all this.
I've been ignoring logging for a while, but it's time to do it better. Currently, the best we really get with logging is the following
core
feedback functions:system_error
: This is only used by TIFA and CAIT currently. It's a feedback object with neutral valence in the SYSTEM category. It's also muted :Plog(*items, sep=" ", **kwargs)
: This is not used anywhere. It's literally calling the genericfeedback
class with the same kind of settings assystem_error
. It basically just converts all the arguments to strings and joins them with spaces as the message.debug(*items, **kwargs)
: Same aslog
but with a higher priority and logs each item as a separatefeedback
call WITHOUT converting to a string.The resolver currently handles the
SYSTEM
category by just collecting all of them that are not suppressed and putting them into theFinalFeedback.systems
list. I don't think even BlockPy does anything with that data, but certainly none of the resolvers dump the info to my knowledge.It seems clear to me that we should use the
logging
builtin library. There's plenty of debug and info stuff to log for each tool. Plenty of warnings and errors I'm sure too. This provides a fairly convenient mechanism to standardize on.Here are our major use cases:
log
anddebug
calls that we have now. My thought is that normally those would go through whatever the environment's Handlers are.However, I think one thing to do is to provide a
FeedbackHandler
(orReportHandler
?) that would easily let someone log things directly to the feedback channels as regular feedback. However, I wouldn't expect people to really want this to be turned on, unless they were quickly trying to debug something through the feedback channel. Instead, they'd want to use whatever the environment's more sophisticated logging handlers would be.