Skip to content

Commit 4cdb83b

Browse files
committed
More error messages
1 parent 3f16d33 commit 4cdb83b

File tree

8 files changed

+10
-26
lines changed

8 files changed

+10
-26
lines changed

dist/pypresence-1.0.9.tar.gz

3.37 KB
Binary file not shown.

pypresence.egg-info/PKG-INFO

Lines changed: 0 additions & 10 deletions
This file was deleted.

pypresence.egg-info/SOURCES.txt

Lines changed: 0 additions & 11 deletions
This file was deleted.

pypresence.egg-info/dependency_links.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

pypresence.egg-info/top_level.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

pypresence/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ def read_output(self):
3838
except BrokenPipeError:
3939
raise InvalidID
4040
code, length = struct.unpack('<ii', data[:8])
41-
return json.loads(data[8:].decode('utf-8'))
41+
payload = json.loads(data[8:].decode('utf-8'))
42+
if payload["evt"] == "ERROR":
43+
raise ServerError(payload["data"]["message"])
44+
return payload
4245

4346

4447
def send_data(self, op: int, payload: dict):

pypresence/exceptions.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
class InvalidID(Exception):
22
def __init__(self):
33
super().__init__('Client ID is Invalid')
4-
4+
55
class InvalidPipe(Exception):
66
def __init__(self):
77
super().__init__('Pipe Not Found - Is Discord Running?')
8+
9+
class ServerError(Exception):
10+
def __init__(self,message):
11+
super().__init__(message.replace(']','').replace('[','').capitalize())

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
setup(name='pypresence',
44
author='qwertyquerty',
55
url='https://github.com/qwertyquerty/pypresence',
6-
version='1.0.7',
6+
version='1.0.9',
77
packages=['pypresence'],
88
license='MIT',
99
description='Discord RPC client written in python',

0 commit comments

Comments
 (0)