Commit b7752e44 authored by Bruno Boiget's avatar Bruno Boiget

Fix error message on server.describe if ID is unknown

parent a15332aa
from zephir.i18n import _ from zephir.i18n import _
from .error import ServerErrorUnknownServerId
""" """
List all servers List all servers
""" """
...@@ -149,13 +151,16 @@ def list_all_servers(cursor): ...@@ -149,13 +151,16 @@ def list_all_servers(cursor):
def fetch_server_dict(cursor, serverid: int): 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): def fetch_server(cursor, serverid: int):
fetched = fetchone(cursor, FETCH_SERVER, (serverid,)) fetched = fetchone(cursor, FETCH_SERVER, (serverid,))
if fetched is None: 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 return fetched
Markdown is supported
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