cengal.io.socket.errors.versions.v_0.errors

Module Docstring Docstrings: http://www.python.org/dev/peps/pep-0257/

 1#!/usr/bin/env python
 2# coding=utf-8
 3
 4# Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space>
 5# 
 6# Licensed under the Apache License, Version 2.0 (the "License");
 7# you may not use this file except in compliance with the License.
 8# You may obtain a copy of the License at
 9# 
10#     http://www.apache.org/licenses/LICENSE-2.0
11# 
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17
18"""
19Module Docstring
20Docstrings: http://www.python.org/dev/peps/pep-0257/
21"""
22
23__author__ = "ButenkoMS <gtalk@butenkoms.space>"
24__copyright__ = "Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space>"
25__credits__ = ["ButenkoMS <gtalk@butenkoms.space>", ]
26__license__ = "Apache License, Version 2.0"
27__version__ = "4.4.1"
28__maintainer__ = "ButenkoMS <gtalk@butenkoms.space>"
29__email__ = "gtalk@butenkoms.space"
30# __status__ = "Prototype"
31__status__ = "Development"
32# __status__ = "Production"
33
34
35import os
36import errno
37
38
39if 'nt' == os.name:
40    if not hasattr(errno, 'WSAEPIPE'):
41        WSAEPIPE = -12345
42    
43    SET_OF_CONNECTION_ERRORS = {errno.WSAECONNRESET, errno.WSAECONNREFUSED, errno.WSAECONNABORTED, WSAEPIPE, errno.WSAESHUTDOWN}
44    SET_OF_UDP_MESSAGE_SIZE_RELATED_ERRORS = {errno.WSAEMSGSIZE}
45else:
46    SET_OF_CONNECTION_ERRORS = {errno.ECONNRESET, errno.ECONNREFUSED, errno.ECONNABORTED, errno.EPIPE, errno.ESHUTDOWN}
47    SET_OF_UDP_MESSAGE_SIZE_RELATED_ERRORS = {errno.EMSGSIZE}
48
49
50
51try:
52    BlockingIOError
53except NameError:
54    class BlockingIOError(OSError):
55        pass
56
57try:
58    InterruptedError
59except NameError:
60    class InterruptedError(OSError):
61        pass
62
63try:
64    ConnectionError
65except NameError:
66    class ConnectionError(OSError):
67        pass
68
69try:
70    BrokenPipeError
71except NameError:
72    class BrokenPipeError(ConnectionError):
73        pass
74
75try:
76    ConnectionAbortedError
77except NameError:
78    class ConnectionAbortedError(ConnectionError):
79        pass
80
81try:
82    ConnectionRefusedError
83except NameError:
84    class ConnectionRefusedError(ConnectionError):
85        pass
86
87try:
88    ConnectionResetError
89except NameError:
90    class ConnectionResetError(ConnectionError):
91        pass