Uncaught exception when SSID and PWD are not provided - plus why is empty SSID allowed?
Opened this issue · 2 comments
ScruffR commented
I've got this funny behaviour with the current version of CLI, that when I enter "n" on the "Scan for WiFi" question, the SSID entry is skiped (or immediately auto commited empty).
When I then just skip the WPA2/WPA/WEP/Open and PWD questions by just hitting [ENTER], I get this
C:\Users\Andy>particle serial wifi
? Should I scan for nearby Wi-Fi networks? (Y/n) n
? Should I scan for nearby Wi-Fi networks? No
? SSID:
? Security Type: WPA2
? Wi-Fi Password:
C:\Users\Andy\AppData\Roaming\npm\node_modules\particle-cli\node_modules\inquire
r\node_modules\rx\dist\rx.js:579
throw e;
^
TypeError: Cannot read property 'ssid' of undefined
at PromptUI.completed (C:\Users\Andy\AppData\Roaming\npm\node_modules\partic
le-cli\commands\SerialCommand.js:349:41)
at PromptUI.onCompletion (C:\Users\Andy\AppData\Roaming\npm\node_modules\par
ticle-cli\node_modules\inquirer\lib\ui\prompt.js:69:10)
at AnonymousObserver.Rx.AnonymousObserver.AnonymousObserver.completed (C:\Us
ers\Andy\AppData\Roaming\npm\node_modules\particle-cli\node_modules\inquirer\nod
e_modules\rx\dist\rx.js:1793:12)
at AnonymousObserver.Rx.internals.AbstractObserver.AbstractObserver.onComple
ted (C:\Users\Andy\AppData\Roaming\npm\node_modules\particle-cli\node_modules\in
quirer\node_modules\rx\dist\rx.js:1730:14)
at AnonymousObserver.tryCatcher (C:\Users\Andy\AppData\Roaming\npm\node_modu
les\particle-cli\node_modules\inquirer\node_modules\rx\dist\rx.js:567:29)
at AutoDetachObserverPrototype.completed (C:\Users\Andy\AppData\Roaming\npm\
node_modules\particle-cli\node_modules\inquirer\node_modules\rx\dist\rx.js:5288:
56)
at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onCompl
eted (C:\Users\Andy\AppData\Roaming\npm\node_modules\particle-cli\node_modules\i
nquirer\node_modules\rx\dist\rx.js:1730:14)
at InnerObserver.onCompleted (C:\Users\Andy\AppData\Roaming\npm\node_modules
\particle-cli\node_modules\inquirer\node_modules\rx\dist\rx.js:3425:65)
at InnerObserver.tryCatcher (C:\Users\Andy\AppData\Roaming\npm\node_modules\
particle-cli\node_modules\inquirer\node_modules\rx\dist\rx.js:567:29)
at AutoDetachObserverPrototype.completed (C:\Users\Andy\AppData\Roaming\npm\
node_modules\particle-cli\node_modules\inquirer\node_modules\rx\dist\rx.js:5288:
56)
at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onCompl
eted (C:\Users\Andy\AppData\Roaming\npm\node_modules\particle-cli\node_modules\i
nquirer\node_modules\rx\dist\rx.js:1730:14)
When first letting the WiFi scan happen, I get
C:\Users\Andy>particle serial wifi
? Should I scan for nearby Wi-Fi networks? (Y/n)
? Should I scan for nearby Wi-Fi networks? Yes
? Uh oh, no networks found. Try again? No
? SSID:
then it works as expected.
A possible and useful workaround might be to keep repeating the SSID question till something actually is entered - empty SSIDs make no sense to me anyway.
I'm on Win8.1Pro64bit.
KarbonDallas commented
hey @ScruffR! I believe I merged a PR by @kennethlimcp that fixes this behavior! I will have a new version published by tomorrow with this fix in it.
ScruffR commented
I'll have a test then 👍