Closed mikicz closed 2 years ago
Yeah good point, gonna make this more explicit. As you already said, field or even row/obj backtracking will be alot harder, as the code currently tries very hard to process things fast. Will see what I can do about that.
@mikicz Giving the field name as argument to the encoders has only small perf penalty (<<5%), so gonna add that for easier debugging.
Exception message would look like:
...
raise TypeError(f'expected type {int} for field "{fname}", got {type(v)}')
TypeError: expected type <class 'int'> for field "f1", got <class 'str'>
Edit: Also tested with additional pk or position reporting, this makes it way more expensive adding ~15% to total runtime. Thus I wont add it for now. Imho the fieldname and the wrong type are enough clues for anyone to scan their data for the culprits.
A lot of my tests are failing because of TypeError coming from the encoders, and the error message is not very helpful.
I think it would make debugging much easier if it said what type the object was. For example:
Best would of course be if it also said what field the issue is in, but that might be harder to do.