Browse Source

Use Python 3 super(), and add self.message back to my exceptions

tags/nilmdb-2.0.0
Jim Paris 4 years ago
parent
commit
752a9b36ae
2 changed files with 3 additions and 2 deletions
  1. +1
    -1
      nilmdb/client/errors.py
  2. +2
    -1
      nilmdb/server/errors.py

+ 1
- 1
nilmdb/client/errors.py View File

@@ -9,7 +9,7 @@ class Error(Exception):
message = None,
url = None,
traceback = None):
Exception.__init__(self, status)
super().__init__(status)
self.status = status # e.g. "400 Bad Request"
self.message = message # textual message from the server
self.url = url # URL we were requesting


+ 2
- 1
nilmdb/server/errors.py View File

@@ -3,7 +3,8 @@
class NilmDBError(Exception):
"""Base exception for NilmDB errors"""
def __init__(self, message = "Unspecified error"):
Exception.__init__(self, message)
super().__init__(message)
self.message = message

class StreamError(NilmDBError):
pass


Loading…
Cancel
Save