Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_exceptions.py 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. """
  2. _exceptions.py
  3. websocket - WebSocket client library for Python
  4. Copyright 2023 engn33r
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. """
  15. class WebSocketException(Exception):
  16. """
  17. WebSocket exception class.
  18. """
  19. pass
  20. class WebSocketProtocolException(WebSocketException):
  21. """
  22. If the WebSocket protocol is invalid, this exception will be raised.
  23. """
  24. pass
  25. class WebSocketPayloadException(WebSocketException):
  26. """
  27. If the WebSocket payload is invalid, this exception will be raised.
  28. """
  29. pass
  30. class WebSocketConnectionClosedException(WebSocketException):
  31. """
  32. If remote host closed the connection or some network error happened,
  33. this exception will be raised.
  34. """
  35. pass
  36. class WebSocketTimeoutException(WebSocketException):
  37. """
  38. WebSocketTimeoutException will be raised at socket timeout during read/write data.
  39. """
  40. pass
  41. class WebSocketProxyException(WebSocketException):
  42. """
  43. WebSocketProxyException will be raised when proxy error occurred.
  44. """
  45. pass
  46. class WebSocketBadStatusException(WebSocketException):
  47. """
  48. WebSocketBadStatusException will be raised when we get bad handshake status code.
  49. """
  50. def __init__(self, message: str, status_code: int, status_message=None, resp_headers=None, resp_body=None):
  51. super().__init__(message)
  52. self.status_code = status_code
  53. self.resp_headers = resp_headers
  54. self.resp_body = resp_body
  55. class WebSocketAddressException(WebSocketException):
  56. """
  57. If the websocket address info cannot be found, this exception will be raised.
  58. """
  59. pass