From 34275f9b630861cbc64e76e6ee78271e87537bec Mon Sep 17 00:00:00 2001 From: David Todd Date: Sat, 18 Jan 2020 22:33:02 -0600 Subject: [PATCH] Add conflict message --- api/api.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/api.py b/api/api.py index b675e8c..8f4d9a6 100644 --- a/api/api.py +++ b/api/api.py @@ -138,10 +138,16 @@ class API: Returns a JSON object containing everything about the bookmark """ + conflict_msg = "The new bookmark_id matches one already existing in the database." \ + "Perhaps you want to delete this bookmark instead?" + response.content_type = self.response_type bookmark = self.database.update_bookmark_uri(UUID(bookmark_id), uri) if bookmark == None: return abort(404, "Provided bookmark doesn't exist or has been deleted") + if not bookmark: + return abort(409, conflict_msg) + return json.dumps(self._get_bookmark_object(bookmark))