Open stdedos opened 1 year ago
Great point! Feel like creating a PR? we should probably keep the existing behavior for reasonably-sized objects, but then past some size (1000 chars?) truncate and say something like ... (truncated - 1543464 characters total)
Sure, why not? Anything can be done; but please give me your (repo's) requirements:
...
s?) Maybe I can donate that even tomorrow.
Excellent, thank you in advance 😎
How easy / complex you'd like the solution?
As simple as possible while getting the job done. Particularly in error handling, short & readable code is more important to us than performance.
Ellipsize / Truncate (with or without
...
s?) ... at how many characters? ... with the text-prompt you included?
Thinking about this more, since this error is always about a bad type we don't need that many characters, just enough to help you find the object in your code. So maybe 100 characters, then yes, ...
plus a description like in my comment so it's clear to the reader what we did.
The simplest one would've been {bad_val:.100s}
, but not all classes implement __format__
😅 (in my case, a @dataclass
)
... neither would it have had the requested bells and whistles.
and {bad_val!s}
does not support the format-language (so !.100s
is invalid)
🙃
I have sent my review - I hope it is straightforward.
Would you consider truncating/ellipsisizing the
{bad_val}
output ofhttps://github.com/plotly/dash/blob/c729ef82e179623592d033929126f284837fd178/dash/_validate.py#L238C26-L253
?
Sometimes the output can be humongous, which affects browser rendering 😕