File: exceptions.py

package info (click to toggle)
freenub 0.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,168 kB
  • sloc: python: 10,664; makefile: 7; sh: 6
file content (20 lines) | stat: -rw-r--r-- 661 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class PubNubException(Exception):
    def __init__(self, errormsg="", status_code=0, pn_error=None, status=None):
        self._errormsg = errormsg
        self._status_code = status_code
        self._pn_error = pn_error
        self.status = status

        if len(str(errormsg)) > 0 and int(status_code) > 0:
            msg = str(pn_error) + " (" + str(status_code) + "): " + str(errormsg)
        elif len(str(errormsg)) > 0:
            msg = str(pn_error) + ": " + str(errormsg)
        else:
            msg = str(pn_error)

        super().__init__(msg)

    @property
    def _status(self):
        raise DeprecationWarning
        return self.status