-
Notifications
You must be signed in to change notification settings - Fork 371
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
Throw exception when connecting fails #693
Conversation
Removed a redundant test connecting device to device, and added a new test for illegal connections.
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.
This looks in principle sound to me, but @jakobj needs to review and comment on the change to the test for #211. There may have been a reason for silently skipping the device-device connection.
Travis currently fails due to formatting problems. I would suggest to wait until #691 is merged to master, merge that then from master into this branch.
@jakobj Since you wrote the test that is modified here, could you review the change in the |
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.
These are reasonably changes, however I think one return was missed and the tests need to be adapted. ps: sorry for taking so long to review.
@@ -68,11 +68,6 @@ n2 d4 << /weight 1. >> Connect | |||
[g5 g5] [n1] Connect | |||
g5 n3 << /weight 1. >> Connect | |||
|
|||
% device-device; but g5g5 should be ignored |
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.
why did you remove this whole block? I think the connection g5 -> g4 is still valid, and actually created, so I would suggest just removing the first line ([g5 g5] [d4 g5] /one_to_one Connect
) and keeping the others. This would imply that you need to remove one [5 4 0]
from the target_conn
list.
@@ -177,3 +177,52 @@ ResetKernel | |||
Last /target get 6 eq assert_or_die | |||
|
|||
} forall | |||
|
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.
maybe it would make sense to get all devices from the modeldict and loop through all possible combinations instead of listing them manually here? this would avoid the need to add new tests here upon adding a new device and make sure that we do not forget a certain combination.
@@ -413,7 +413,8 @@ nest::ConnectionManager::connect( index sgid, | |||
// we do not allow to connect a device to a global receiver at the moment | |||
if ( not source->has_proxies() ) | |||
{ | |||
return; | |||
throw IllegalConnection( "The models " + target->get_name() + " and " |
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.
should we throw a similar error in line546?
Now tests creating of connection between all combinations of models, checking for silent failures. Also, added a missing throw IllegalConnection.
@jakobj Thank you for you review. Besides reinstating the missing test in issue-211 and adding a |
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 except for one simplification in the test, see inline comment.
testsuite/unittests/test_connect.sli
Outdated
pop % remove model id | ||
/model_a Set | ||
/type_a model_a GetDefaults /element_type get def | ||
/m_a model_a Create def |
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.
It looks to me as if you do not need type_a
anywhere, so I think you can shorten this to
pop exch Create /node_a Set
and similarly for b
below.
@jakobj Could you have another look? |
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 👍 maybe it would be better to squash the commits before merging?
@jakobj I will merge as is---still a bit wary of re-writing history after it has become visible in public repositories. |
This PR fixes an issue where in some cases an attempt to create a connection fails silently, such as when trying to connect a multimeter to a generator. NEST will now throw an exception in these cases.
Additionally, a part of the regressiontest issue-211 that now throws an exception has been removed, and tests to make sure that NEST throws an exception to avoid silent failure has been added.
This fixes #578.