add additional error codes
re-classify some errors with more specific codes and more appropriate logging levels
Fix a crash following use of the stop_listening function.