better exception handling for sms_server.py