MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / ConnectionLost

Class ConnectionLost

web/pgadmin/utils/exception.py:20–52  ·  view source on GitHub ↗

Exception

Source from the content-addressed store, hash-verified

18
19
20class ConnectionLost(HTTPException):
21 """
22 Exception
23 """
24
25 def __init__(self, _server_id, _database_name, _conn_id):
26 self.sid = _server_id
27 self.db = _database_name
28 self.conn_id = _conn_id
29 HTTPException.__init__(self)
30
31 @property
32 def name(self):
33 return HTTP_STATUS_CODES.get(503, SERVICE_UNAVAILABLE)
34
35 def get_response(self, environ=None, scope=None):
36 return service_unavailable(
37 _("Connection to the server has been lost."),
38 info="CONNECTION_LOST",
39 data={
40 'sid': self.sid,
41 'database': self.db,
42 'conn_id': self.conn_id
43 }
44 )
45
46 def __str__(self):
47 return "Connection (id #{2}) lost for the server (#{0}) on " \
48 "database ({1})".format(self.sid, self.db, self.conn_id)
49
50 def __repr__(self):
51 return "Connection (id #{2}) lost for the server (#{0}) on " \
52 "database ({1})".format(self.sid, self.db, self.conn_id)
53
54
55class SSHTunnelConnectionLost(HTTPException):

Callers 10

_get_connectionFunction · 0.90
__cursorMethod · 0.90
execute_scalarMethod · 0.90
execute_asyncMethod · 0.90
execute_voidMethod · 0.90
execute_dictMethod · 0.90
connectionMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected