Skip to content

Commit 7921435

Browse files
author
Callum Oakley
committed
added errors to readme
1 parent 0d83c57 commit 7921435

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,12 @@ pusher = Pusher(app_id, key, secret)
7979
|port `int` | **Default:`None`** <br>Which port to connect to |
8080
|ssl `bool` | **Default:`True`** <br> Use HTTPS |
8181
|cluster `String` | **Default:`None`** <br> Convention for other clusters than the main Pusher-one. Eg: 'eu' will resolve to the api-eu.pusherapp.com host |
82-
|backend `Object` | an object that responds to the send_request(request) method. If none is provided, a `pusher.requests.RequestsBackend` instance is created. |
82+
|backend `Object` | an object that responds to the `send_request(request)` method. If none is provided, a `pusher.requests.RequestsBackend` instance is created. |
8383
|json_encoder `Object` | **Default: `None`**<br> Custom JSON encoder. |
8484
|json_decoder `Object` | **Default: `None`**<br> Custom JSON decoder.
8585

86+
The constructor will throw a `TypeError` if it is called with parameters that don’t match the types listed above.
87+
8688
##### Example
8789

8890
```py
@@ -107,6 +109,8 @@ To trigger an event on one or more channels, use the `trigger` method on the `Pu
107109
|:-:|:-:|
108110
|buffered_events `Dict` | A parsed response that includes the event_id for each event published to a channel. See example. |
109111

112+
`Pusher::trigger` will throw a `TypeError` if called with parameters of the wrong type; or a `ValueError` if called on more than 10 channels, with an event name longer than 200 characters, or with more than 10240 characters of data (post JSON serialisation).
113+
110114
##### Example
111115

112116
This call will trigger to `'a_channel'` and `'another_channel'`, and exclude the recipient with socket_id `"1234.12"`.
@@ -138,6 +142,7 @@ Events are a `Dict` with keys:
138142
|:-:|:-:|
139143
|`Dict`| An empty dict on success |
140144

145+
`Pusher::trigger_batch` will throw a `TypeError` if the data parameter is not JSONable.
141146

142147
##### Example
143148

@@ -224,6 +229,8 @@ data = {
224229
|:-:|:-:|
225230
|channels `Dict` | A parsed response from the HTTP API. See example. |
226231

232+
`Pusher::channels_info` will throw a `TypeError` if `prefix_filter` is not a `String`.
233+
227234
##### Example
228235

229236
```python
@@ -245,6 +252,8 @@ channels = pusher.channels_info(u"presence-", [u'user_count'])
245252
|:-:|:-:|
246253
|channel `Dict` | A parsed response from the HTTP API. See example. |
247254

255+
`Pusher::channel_info` will throw a `ValueError` if `channel` is not a valid channel.
256+
248257
##### Example
249258

250259
```python
@@ -264,6 +273,8 @@ channel = pusher.channel_info(u'presence-chatroom', [u"user_count"])
264273
|:-:|:-:|
265274
|users `Dict` | A parsed response from the HTTP API. See example. |
266275

276+
`Pusher::users_info` will throw a `ValueError` if `channel` is not a valid channel.
277+
267278
##### Example
268279

269280
```python
@@ -291,6 +302,8 @@ Using your `Pusher` instance, with which you initialized `Pusher`, you can gener
291302
|:-:|:-:|
292303
|response `Dict` | A dictionary to send as a response to the authentication request.|
293304

305+
`Pusher::authenticate` will throw a `ValueError` if the `channel` or `socket_id` that it’s called with are invalid.
306+
294307
##### Example
295308

296309
###### Private Channels
@@ -340,6 +353,8 @@ If you have webhooks set up to POST a payload to a specified endpoint, you may w
340353
|:-:|:-:|
341354
|body_data `Dict` | If validation was successful, the return value will be the parsed payload. Otherwise, it will be `None`. |
342355

356+
`Pusher::validate_webhook` will raise a `TypeError` if it is called with any parameters of the wrong type.
357+
343358
##### Example
344359

345360
```python

0 commit comments

Comments
 (0)