Skip to content

Commit

Permalink
Catching error if there are problems with the image
Browse files Browse the repository at this point in the history
  • Loading branch information
glenrobson committed Jul 24, 2020
1 parent f47d818 commit a7b9ae6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions iiif_validator/tests/region_pixels.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ def run(self, result):
return result
else:
raise ValidatorError('color', 1,0, result)
except:
except Exception as error:
self.validationInfo.check('status', result.last_status, 200, result)
raise
raise ValidatorError('General error', str(error), 'No error', result,'Failed to check size due to: {}'.format(error))
4 changes: 2 additions & 2 deletions iiif_validator/tests/size_ch.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ def run(self, result):
return result
else:
raise ValidatorError('color', 1,0, result)
except:
except Exception as error:
self.validationInfo.check('status', result.last_status, 200, result)
raise
raise ValidatorError('General error', str(error), 'No error', result,'Failed to check size due to: {}'.format(error))
5 changes: 3 additions & 2 deletions iiif_validator/tests/size_percent.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def run(self, result):
else:
raise ValidatorError('color', 1,0, result)

except:
except Exception as error:
self.validationInfo.check('status', result.last_status, 200, result)
raise

raise ValidatorError('General error', str(error), 'No error', result,'Failed to check size due to: {}'.format(error))
5 changes: 2 additions & 3 deletions iiif_validator/tests/size_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,5 @@ def run(self, result):
if not ok:
raise ValidatorError('color', 1, self.validationInfo.colorInfo[0][0], result)
return result
except:
self.validationInfo.check('status', result.last_status, 200, result)
raise
except Exception as error:
raise ValidatorError('General error', str(error), 'No error', result,'Failed to check size due to: {}'.format(error))
6 changes: 3 additions & 3 deletions iiif_validator/tests/size_wc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def run(self, result):
s = random.randint(450,750)
params = {'size': '%s,' % s}
img = result.get_image(params)
self.validationInfo.check('status', result.last_status, 200, result)
self.validationInfo.check('size', img.size, (s,s), result)

# Find square size
Expand All @@ -34,6 +35,5 @@ def run(self, result):
return result
else:
raise ValidatorError('color', 1,0, result)
except:
self.validationInfo.check('status', result.last_status, 200, result)
raise
except Exception as error:
raise ValidatorError('General error', str(error), 'No error', result,'Failed to check size due to: {}'.format(error))

0 comments on commit a7b9ae6

Please sign in to comment.