server/posts: improve errors for bad note points

This commit is contained in:
rr- 2016-08-04 22:53:45 +02:00
parent 721900ee2f
commit 9e2dace73f

View file

@ -292,7 +292,10 @@ def update_post_notes(post, notes):
pos_y = float(point[1]) pos_y = float(point[1])
if not 0 <= pos_x <= 1 or not 0 <= pos_y <= 1: if not 0 <= pos_x <= 1 or not 0 <= pos_y <= 1:
raise InvalidPostNoteError( raise InvalidPostNoteError(
'A point in note\'s polygon must be in 0..1 range.') 'All points must fit in the image (0..1 range).')
except KeyError:
raise InvalidPostNoteError(
'Expected array of length 2.')
except ValueError: except ValueError:
raise InvalidPostNoteError( raise InvalidPostNoteError(
'A point in note\'s polygon must be numeric.') 'A point in note\'s polygon must be numeric.')