Closed andeaseme closed 1 year ago
Not a solution to the error message issue.
The way to fix the code in the example is to wrap item_generator.
with SlabsIter(item=iter(item_generator()).__next__, print_item=print_item) as sit:
for _ in sit:
pass
I added a validation step in the SlabIter
init so that you'll now get the precise error message
TypeError: This component is not callable: item
before you go down the layers to fail in some obscure place that has little resemblance to your context.
There was, in fact, a simple assertion in there already, but for some reason it was commented out. I hope it wasn't a good reason, because now we have validation again.
But I profited of the occasion to do a few things:
SlabsIter will throw errors related to code deep in its own functions without mentioning what inputs could be wrong. Debugging is hard for new users as shown by the following example.
I've written some code and expect it to print the contents
But instead I'm met with an error
The problem has something to do with
None
object but it doesn't tell me what's wrong or where to look. There is really no hints at all.