Commit bd1074bb authored by Matthieu Lamalle's avatar Matthieu Lamalle
Browse files

Merge branch 'feature/189_server_error_message' into 'develop'

Fix error message on server.describe if ID is unknown

See merge request !2
parents 5cf9d3ff b7752e44
from zephir.i18n import _
from .error import ServerErrorUnknownServerId
"""
List all servers
"""
......@@ -149,13 +151,16 @@ def list_all_servers(cursor):
def fetch_server_dict(cursor, serverid: int):
return server_row_to_dict(fetchone(cursor, FETCH_SERVER, (serverid,), raises=True), serverenvironment=True)
server = fetchone(cursor, FETCH_SERVER, (serverid,), raises=False)
if server is None:
raise ServerErrorUnknownServerId(_('Unable to find a server with ID {}').format(serverid))
return server_row_to_dict(server, serverenvironment=True)
def fetch_server(cursor, serverid: int):
fetched = fetchone(cursor, FETCH_SERVER, (serverid,))
if fetched is None:
raise Exception(_('unable to find a server with id {}').format(serverid))
raise Exception(_('unable to find a server with ID {}').format(serverid))
return fetched
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment