Exception
| 18 | |
| 19 | |
| 20 | class 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 | |
| 55 | class SSHTunnelConnectionLost(HTTPException): |
no outgoing calls
no test coverage detected