-
Notifications
You must be signed in to change notification settings - Fork 125
Report errors on SimpleRenderer on missing getters #2670
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
lib/src/mustachio/renderer_base.dart
Outdated
var type = context.runtimeType; | ||
throw MustachioResolutionError(node.keySpan.message( | ||
'$firstName is a getter on $type, which is not visible to Mustache. ' | ||
'To render $firstName on $type, make it visible to mustache; to ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be more specific to help with maintenance, e.g. add to visibleTypes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
lib/src/mustachio/renderer_base.dart
Outdated
|
||
if (this is SimpleRenderer && _invisibleGetters.contains(names.first)) { | ||
var type = context.runtimeType; | ||
throw MustachioResolutionError(node.keySpan.message( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional: This seems like it should work, but there is no end to end test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, there were definitely bugs :P added two tests after fixing the bugs.
Fixes #2667
If Mustachio is resolving a key and it finds a SimpleResolver (a resolver for a type not visible to Mustachio), and the key is a getter on that type, then Mustachio will throw an error rather than continue to other types up the stack.