dgets / DOCshell

Damo's version of the DOC (Citadel-esque) shell, in JavaScript, for use with Synchronet 3.14+ systems
https://www.pivotaltracker.com/n/projects/1206002
4 stars 1 forks source link

Invalid # entered at a room breaks the shell completely #166

Closed dgets closed 9 years ago

dgets commented 9 years ago

When the numeric input is completed, conditional on whether or not the number entered by the user corresponds to a valid message # in Lobby> (or whatever room is dropped back to), hitting enter ends up breaking the shell completely and drops the user from the BBS. See following:

Lobby> Go to message #> 114                                                     
Received base: [object MsgBase] ptr: 114        breaks: false                   
base was closed; reopening                                                      
ptr: 114        base.last_msg: 15                                               
Invalid message? base.subnum: 281 ptr: 114                                      
!JavaScript : uncaught exception: dispMsg() error: Invalid message slot #: 3    

after which the user is dumped from the bbs.

dgets commented 9 years ago

Strangely enough there is still an uncaught exception going on here. That's funny, because I could swear I've got it wrapped up in try/catch blocks all nice 'n tight. Hell, I even used console.getnum(base.last_msg) (or whatever the appropriate last message pointer name is in that object) in order to try to limit the input of the user to a valid range (not the most flexible way to handle this, but I was getting desperate after seeing the try/catch fail so much. It's like it's not even seeing the changes in my code. I wonder if I'm doing something really stupid that is going to result in much facepalming here later...

dgets commented 9 years ago

Instead of throwing an exception when the message number was over-the-top, I ended up displaying an error message and sending them to the sub's last message # instead. Seems like a decent way to handle it, and it avoids the crap with that uncaught exception that I can't seem to figure out right now.