Improve the invalid port format detection. Fixes https://github.com/GNS3/gns3-gui/issues/2580

This commit is contained in:
grossmj 2018-09-05 13:35:42 +08:00
parent abfbadecd6
commit c620d0be84

View File

@ -72,7 +72,7 @@ class StandardPortFactory:
segment_number, segment_number,
adapter=adapter_number, adapter=adapter_number,
**cls._generate_replacement(interface_number, segment_number)) **cls._generate_replacement(interface_number, segment_number))
except (ValueError, KeyError) as e: except (IndexError, ValueError, KeyError) as e:
raise aiohttp.web.HTTPConflict(text="Invalid port name format {}: {}".format(port_name_format, str(e))) raise aiohttp.web.HTTPConflict(text="Invalid port name format {}: {}".format(port_name_format, str(e)))
port = PortFactory(port_name, segment_number, adapter_number, port_number, "ethernet") port = PortFactory(port_name, segment_number, adapter_number, port_number, "ethernet")
interface_number += 1 interface_number += 1