Open leokoppel opened 9 years ago
Hi @leokoppel,
This is not a very friendly error message now is it.
I think that Scheme.for_cell
could check if the cell is encrypted and then throw a TypeError about the missing passkey. Do you think that is appropriate? It would still result in an error, but at least we could control the error message.
Not sure about TypeError as the arguments given do match the function definition; they only go awry of the business logic. A custom exception like InterfaceError seems more appropriate.
I would have submitted a pull request to do this but the intended behaviour was not clear. For example, if the encryption type is 'wep', it would just return with 'wireless-key' : None
and presumably fail upon trying to connect, but not before. So it's a design decision, up to you.
(This was reported on StackOverflow here).
An uncaught
TypeError
is raised whenScheme.for_cell
is called for an encrypted cell, without the optionalpasskey
argument.When no passkey is supplied,
for_cell
callsconfiguration
withpasskey=None
, which, if the encryption happens to be 'wpa', fails onlen(passkey)
in scheme.py:23: