-
Notifications
You must be signed in to change notification settings - Fork 51
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
Update verbalizer error message to include the relevant template string #414
Conversation
Signed-off-by: Mynhardt Burger <mynhardt@gmail.com>
) | ||
return source_object[index_object] | ||
|
||
if not hasattr(source_object, index_object): | ||
error( | ||
"<NLP97715112E>", | ||
AttributeError( | ||
"Requested template string is not a valid property of type" | ||
"Requested template string '%s' is not a valid property of type", | ||
index_object, |
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.
also we should check if this index_object
is actually a string, otherwise might cause problem without explicit stringification
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.
I don't think it is possible for the fstring to fail no matter the type of index_object
, unless the __str__
dunder method was overwritten and that raises an exception.
By default str()
is used to serialize the object. At worst the the output might be in repr()
format.
Co-authored-by: Gaurav Kumbhat <kumbhat.gaurav@gmail.com> Signed-off-by: Mynhardt Burger <mynhardt@gmail.com>
Co-authored-by: Gaurav Kumbhat <kumbhat.gaurav@gmail.com> Signed-off-by: Mynhardt Burger <mynhardt@gmail.com>
Signed-off-by: Mynhardt Burger <mynhardt@gmail.com>
Signed-off-by: Mynhardt Burger <mynhardt@gmail.com>
Signed-off-by: Mynhardt Burger <mynhardt@gmail.com>
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.
Looks good to me!
Update the exception message to include the template field which is the cause for the error.