feat: implement AttributeError in Service initialization

This commit is contained in:
Xyphuz 2022-05-19 00:44:18 +08:00
parent 82e7951444
commit b091f41699

View file

@ -18,10 +18,10 @@ class Service:
self._name = name self._name = name
if image is None and extends is None: if image is None and extends is None:
raise ValueError(f"Both image and extends are not defined in service '{name}', aborting.") raise AttributeError(f"Both image and extends are not defined in service '{name}', aborting.")
if image is not None and extends is not None: if image is not None and extends is not None:
raise ValueError(f"Only one of image and extends can be defined in service '{name}', aborting.") raise AttributeError(f"Only one of image and extends can be defined in service '{name}', aborting.")
self._image = image self._image = image
self._ports = ports self._ports = ports