Package pushnotify :: Module exceptions
[hide private]
[frames] | no frames]

Source Code for Module pushnotify.exceptions

  1  #!/usr/bin/env python 
  2  # -*- coding: utf-8 -*- 
  3  # 
  4  # Copyright (C) 2013 Jeffrey Goettsch and other contributors. 
  5  # 
  6  # This file is part of py-pushnotify. 
  7  # 
  8  # py-pushnotify is free software: you can redistribute it and/or modify 
  9  # it under the terms of the GNU General Public License as published by 
 10  # the Free Software Foundation, either version 3 of the License, or 
 11  # (at your option) any later version. 
 12  # 
 13  # py-pushnotify is distributed in the hope that it will be useful, 
 14  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
 15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16  # GNU General Public License for more details. 
 17  # 
 18  # You should have received a copy of the GNU General Public License 
 19  # along with py-pushnotify.  If not, see <http://www.gnu.org/licenses/>. 
 20   
 21  """Module for exceptions. 
 22   
 23  """ 
 24   
 25   
26 -class PushNotifyError(Exception):
27 """Base exception for all pushnotify errors. 28 29 Args: 30 args[0]: A string containing a message. 31 args[1]: An integer containing an error. 32 33 """ 34
35 - def __init__(self, *args):
36 37 super(PushNotifyError, self).__init__() 38 self.args = [arg for arg in args]
39 40
41 -class ApiKeyError(PushNotifyError):
42 """Raised when a provided API key is invalid 43 44 Args: 45 args[0]: A string containing a message from the server. 46 args[1]: An integer containing an error code from the server. 47 48 """ 49 50 pass
51 52
53 -class FormatError(PushNotifyError):
54 """Raised when a request is not in the expected format. 55 56 Args: 57 args[0]: A string containing a message from the server. 58 args[1]: An integer containing an error code from the server. 59 60 """ 61 62 pass
63 64
65 -class PermissionDenied(PushNotifyError):
66 """Raised when a request had not been approved. 67 68 Args: 69 args[0]: A string containing a message from the server. 70 args[1]: An integer containing an error code from the server. 71 72 """ 73 74 pass
75 76
77 -class ProviderKeyError(PushNotifyError):
78 """Raised when a provided Provider key is invalid. 79 80 Args: 81 args[0]: A string containing a message from the server. 82 args[1]: An integer containing an error code from the server. 83 84 """ 85 pass
86 87
88 -class RateLimitExceeded(PushNotifyError):
89 """Raised when too many requests are submitted in too small a time 90 frame. 91 92 Args: 93 args[0]: A string containing a message from the server. 94 args[1]: An integer containing an error code from the server. 95 96 """ 97 98 pass
99 100
101 -class ServerError(PushNotifyError):
102 """Raised when the notification server experiences an internal error. 103 104 Args: 105 args[0]: A string containing a message from the server. 106 args[1]: An integer containing an error code from the server. 107 108 """ 109 110 pass
111 112
113 -class UnknownError(PushNotifyError):
114 """Raised when the notification server returns an unknown error. 115 116 Args: 117 args[0]: A string containing a message from the server. 118 args[1]: An integer containing an error code from the server. 119 120 """ 121 122 pass
123 124
125 -class UnrecognizedResponseError(PushNotifyError):
126 """Raised when the notification server returns an unrecognized 127 response. 128 129 Args: 130 args[0]: A string containing the response from the server. 131 args[1]: -1. 132 133 """ 134 135 pass
136 137 138 if __name__ == '__main__': 139 pass 140