Skip to content

Commit d7d8e5d

Browse files
Millefeuille42Nambrok
authored andcommitted
fix: display image format as its string value in error message (#154)
Signed-off-by: Mathieu Labourier <mathieu.labourier@vates.tech>
1 parent 9978d7f commit d7d8e5d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/SR.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
getVdiTypeFromImageFormat,
3737
ImageFormat,
3838
parseImageFormats,
39-
STR_TO_IMAGE_FORMAT
39+
STR_TO_IMAGE_FORMAT,
40+
IMAGE_FORMAT_TO_STR,
4041
)
4142

4243
from vditype import VdiType
@@ -565,7 +566,7 @@ def _init_image_formats(
565566
def _resolve_vdi_type_from_image_format(self, image_format: ImageFormat) -> str:
566567
if image_format in self.supported_image_formats:
567568
return getVdiTypeFromImageFormat(image_format)
568-
raise xs_errors.XenError('VDIType', opterr=f'Unsupported image format `{image_format}`')
569+
raise xs_errors.XenError('VDIType', opterr=f'Unsupported image format `{IMAGE_FORMAT_TO_STR[image_format]}`')
569570

570571
def _get_snap_vdi_type(self, vdi_type: str, size: int) -> str:
571572
if VdiType.isCowImage(vdi_type):

0 commit comments

Comments
 (0)