Err instead of panic for host object attribute error #288
No reviewers
Labels
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: M-Labs/nac3#288
Loading…
Reference in New Issue
No description provided.
Delete Branch "281-host-obj-attribute-err"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is a fix to #281: proper error message is returned now instead of panic
@ -674,0 +674,4 @@
Ok(d) => d,
Err(e) => {
if e.is_instance::<PyAttributeError>(py) {
return Ok(Err(format!("{}", e).replace("AttributeError: ", "")));
Why?
Won't other types of errors have the same issue? I don't see what's special about AttributeError. The default behavior of printing
AttributeError("...")
seems acceptable to me (for now) and should be simple enough.Here I think that it should only catch
AttributeError
because we are usinggetattr
to get the member of an object, so we are only expectingAttributeError
to happen here. Other errors should not happen.Hmm maybe it's better to use
unreachable!
to mark that internal error and panic here?ba0de43526
to54b7af270d
force-pushed to use
unreachable!
to handle internal error in which exception other thanAttributeError
are thrown from python interpreterNo, there can be other exceptions. For example:
Please remove the special-casing.
54b7af270d
to09820e5aed
Thanks for pointing this out! Force-pushed to catch all types of exceptions and updated to the latest master branch.