What do you mean with debug window, do you mean /debug?
If you want to troubleshoot mIRC errors like you mentioned, you can simply use on disconnect


#mircscripting @ irc.swiftirc.net == the best mIRC help channel