From 935b4e15aa80940752ba3d382f3e6bab4b0f06c5 Mon Sep 17 00:00:00 2001 From: Luna Date: Thu, 24 Jan 2019 00:27:10 -0300 Subject: [PATCH] relationships: add messages to errors Closes #30 --- litecord/blueprints/relationships.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/litecord/blueprints/relationships.py b/litecord/blueprints/relationships.py index 0544342..760d44a 100644 --- a/litecord/blueprints/relationships.py +++ b/litecord/blueprints/relationships.py @@ -147,10 +147,12 @@ async def make_friend(user_id: int, peer_id: int, class RelationshipFailed(BadRequest): + """Exception for general relationship errors.""" error_code = 80004 class RelationshipBlocked(BadRequest): + """Exception for when the peer has blocked the user.""" error_code = 80001 @@ -163,12 +165,12 @@ async def post_relationship(): str(j['discriminator'])) if not uid: - raise RelationshipFailed() + raise RelationshipFailed('No users with DiscordTag exist') res = await make_friend(user_id, uid) if res is None: - raise RelationshipBlocked() + raise RelationshipBlocked('Can not friend user due to block') return '', 204