handling of errors on read_web

This commit is contained in:
klemek
2020-04-30 08:50:38 +02:00
parent 7c076b896f
commit 671f6fd595
2 changed files with 12 additions and 7 deletions
+2 -4
View File
@@ -72,12 +72,10 @@ def compute_part(*args: str, input_data: Optional[bytes] = None,
if input_data is None or len(input_data) == 0:
if len(args) <= 1:
return None, 'Image: received no input data nor URL'
elif not utils.validate_url(args[1]):
return None, 'Image: invalid URL format'
else:
input_data = utils.read_web(args[1])
input_data, err = utils.read_web(args[1])
if input_data is None:
return None, 'Image: could not reach URL'
return None, 'Image: ' + err
img = img_factory.build_image_only(input_data)
if img is None:
return None, 'Image: invalid image format'