From 444f169b86ee578eb8fd02c907a07f09ab612412 Mon Sep 17 00:00:00 2001 From: PhilipTrauner Date: Tue, 29 Mar 2016 23:35:58 +0200 Subject: [PATCH] Added function collection --- Shared/Utils.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Shared/Utils.py b/Shared/Utils.py index 01f3f7f..13f2022 100644 --- a/Shared/Utils.py +++ b/Shared/Utils.py @@ -3,4 +3,12 @@ from sys import exc_info def capture_trace(): exc_type, exc_value, exc_traceback = exc_info() - print_exception(exc_type, exc_value, exc_traceback) \ No newline at end of file + print_exception(exc_type, exc_value, exc_traceback) + +def is_socket_related_error(error): + if type(error) not in (BrokenPipeError, ConnectionResetError, OSError): + return False + if type(error) is OSError: + if str(error) not in ("Connection closed", "[Errno 9] Bad file descriptor"): + return False + return True \ No newline at end of file