From 9e2dace73fb3a237c36f8d633648ccafff31a0d1 Mon Sep 17 00:00:00 2001
From: rr- <rr-@sakuya.pl>
Date: Thu, 4 Aug 2016 22:53:45 +0200
Subject: [PATCH] server/posts: improve errors for bad note points

---
 server/szurubooru/func/posts.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/server/szurubooru/func/posts.py b/server/szurubooru/func/posts.py
index 4c7f5be2..17052602 100644
--- a/server/szurubooru/func/posts.py
+++ b/server/szurubooru/func/posts.py
@@ -292,7 +292,10 @@ def update_post_notes(post, notes):
                 pos_y = float(point[1])
                 if not 0 <= pos_x <= 1 or not 0 <= pos_y <= 1:
                     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:
                 raise InvalidPostNoteError(
                     'A point in note\'s polygon must be numeric.')