You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the file containing an Affix component class is not named class name (in lower case) + .r2py, then calling affix_stack.find_and_register_affix might succeed importing, but fail registering internally the component, and throw a rather unspecific KeyError.
In the code leading to the traceback below,
transparenttcprelayaffix.r2py defines a class Transparent_TCPRelayAffix;
the user code tries to instantiate an Affix stack including TransparentTCPRelayAffix (which yields the filename when .lowered, but is not the class name), and
when affix_stack.find_and_register_affix tries to copy the Affix's _context, that context (named after the class) doesn't exist, resulting in the KeyError.
It would be a good idea to check for this mismatch, and raise a more descriptive error message. (I assume a developer running unit tests would catch it very early on in the development, and trivially correct this mistake).
Uncaught exception!
---
Following is a full traceback, and a user traceback.
The user traceback excludes non-user modules. The most recent call is displayed last.
Full debugging traceback:
"repy.py", line 154, in execute_namespace_until_completion
"/private/tmp/affix/RUNNABLE/virtual_namespace.py", line 117, in evaluate
"/private/tmp/affix/RUNNABLE/safe.py", line 588, in safe_run
"dylink.r2py", line 546, in <module>
"dylink.r2py", line 407, in dylink_dispatch
"dylink.r2py", line 520, in evaluate
"/private/tmp/affix/RUNNABLE/virtual_namespace.py", line 117, in evaluate
"/private/tmp/affix/RUNNABLE/safe.py", line 588, in safe_run
"test-ttr.r2py", line 5, in <module>
"affix_stack.r2py", line 32, in __init__
"affix_stack.r2py", line 133, in build_stack
"affix_stack.r2py", line 218, in find_and_register_affix
"/private/tmp/affix/RUNNABLE/safe.py", line 678, in __getitem__
User traceback:
"dylink.r2py", line 546, in <module>
"dylink.r2py", line 407, in dylink_dispatch
"dylink.r2py", line 520, in evaluate
"test-ttr.r2py", line 5, in <module>
"affix_stack.r2py", line 32, in __init__
"affix_stack.r2py", line 133, in build_stack
"affix_stack.r2py", line 218, in find_and_register_affix
Exception (with type 'exceptions.KeyError'): 'Transparent_TCPRelayAffix'
The text was updated successfully, but these errors were encountered:
aaaaalbert
changed the title
tcprelayaffix throws strange error on mismatch of File & Affix component name
Improve affix_stack error on Affix file / class name mismatch
Oct 31, 2014
If the file containing an Affix component class is not named class name (in lower case) +
.r2py
, then callingaffix_stack.find_and_register_affix
might succeed importing, but fail registering internally the component, and throw a rather unspecificKeyError
.In the code leading to the traceback below,
transparenttcprelayaffix.r2py
defines aclass Transparent_TCPRelayAffix
;TransparentTCPRelayAffix
(which yields the filename when.lower
ed, but is not the class name), andaffix_stack.find_and_register_affix
tries to copy the Affix's_context
, that context (named after the class) doesn't exist, resulting in theKeyError
.It would be a good idea to check for this mismatch, and raise a more descriptive error message. (I assume a developer running unit tests would catch it very early on in the development, and trivially correct this mistake).
The text was updated successfully, but these errors were encountered: