-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Meta issue for discussion of a debug API #4
Comments
We definitely need to be able to give actionable errors to users if this data is coming from some configuration file and they wrote an incorrect type. |
Right - a question is, what level of detail is actionable? For example, given:
Is this actionable enough?
Or do we need something more like:
The latter requires keeping a stack of the keys encountered along the path to the current cast point. Not hard to do, and we could easily add a debug version that you could just swap in by importing |
I suspect we need the latter. To get to parity with what we're able to do with Hopefully with a path through keys (and indexes) we can figure out a way to get the source span from |
For that though, I think you're not casting, you're parsing. That's what I'd like to get to. I'd like to either have (as part of the package) a |
Ah I see. The distinction between "parse" and "cast" makes sense to me. I don't have strong opinions on whether or when we need the extra context for "cast" |
Should there be a separate debug version of the classes? I deliberately avoided keeping a full trace of the path through the tree to the current parse point, since that requires allocation and/or putting handlers at every step. For performance, we should probably avoid that, at least in production. We could do nasty things with asserts, but it might be better to provide a separate version of the library
cast_debug.dart
that extends each class and intercepts the_cast
calls to keep a stack. Is this necessary, or can we give good enough error messages without this?The text was updated successfully, but these errors were encountered: