Exception when connection to SSH tunnel is lost
| 53 | |
| 54 | |
| 55 | class SSHTunnelConnectionLost(HTTPException): |
| 56 | """ |
| 57 | Exception when connection to SSH tunnel is lost |
| 58 | """ |
| 59 | |
| 60 | def __init__(self, _tunnel_host): |
| 61 | self.tunnel_host = _tunnel_host |
| 62 | HTTPException.__init__(self) |
| 63 | |
| 64 | @property |
| 65 | def name(self): |
| 66 | return HTTP_STATUS_CODES.get(503, SERVICE_UNAVAILABLE) |
| 67 | |
| 68 | def get_response(self, environ=None, scope=None): |
| 69 | return service_unavailable( |
| 70 | _("Connection to the SSH Tunnel for host '{0}' has been lost. " |
| 71 | "Reconnect to the database server.").format(self.tunnel_host), |
| 72 | info="SSH_TUNNEL_CONNECTION_LOST", |
| 73 | data={ |
| 74 | 'tunnel_host': self.tunnel_host |
| 75 | } |
| 76 | ) |
| 77 | |
| 78 | def __str__(self): |
| 79 | return "Connection to the SSH Tunnel for host '{0}' has been lost. " \ |
| 80 | "Reconnect to the database server".format(self.tunnel_host) |
| 81 | |
| 82 | def __repr__(self): |
| 83 | return "Connection to the SSH Tunnel for host '{0}' has been lost. " \ |
| 84 | "Reconnect to the database server".format(self.tunnel_host) |
| 85 | |
| 86 | |
| 87 | class CryptKeyMissing(HTTPException): |
no outgoing calls
no test coverage detected