/
exception.py
48 lines (38 loc) · 1.04 KB
/
exception.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# -*- coding: utf-8 -*-
"""
.. moduleauthor:: Kai <z@kwi.li>
"""
class APIException(Exception):
"""The API server returned an error."""
def __init__(self, code, msg):
super(APIException, self).__init__(msg)
self.code = code
class KeepException(Exception):
"""Generic Keep error."""
pass
class LoginException(KeepException):
"""Login exception."""
pass
class LabelException(KeepException):
"""Keep label error."""
pass
class SyncException(KeepException):
"""Keep consistency error."""
pass
class ResyncRequiredException(SyncException):
"""Full resync required error."""
pass
class UpgradeRecommendedException(SyncException):
"""Upgrade recommended error."""
pass
class MergeException(KeepException):
"""Node consistency error."""
pass
class InvalidException(KeepException):
"""Constraint error."""
pass
class ParseException(KeepException):
"""Parse error."""
def __init__(self, msg, raw):
super(ParseException, self).__init__(msg)
self.raw = raw