forked from leejaycoke/pilot-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exception.py
67 lines (43 loc) · 1.14 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# -*- coding: utf-8 -*-
from abc import ABCMeta, abstractproperty
class PilotException(Exception, metaclass=ABCMeta):
errors = None
def __init__(self, errors=None):
self.errors = errors
super().__init__(self.message)
@abstractproperty
def code(self):
pass
@abstractproperty
def message(self):
pass
class Unauthorized(PilotException):
@property
def code(self):
return 401
@property
def message(self):
return "로그인이 필요합니다."
def __str__(self):
return self.__class__.__name__
class AccessDenied(PilotException):
@property
def code(self):
return 403
@property
def message(self):
return "접근할 수 없습니다."
class InvalidLogin(PilotException):
@property
def code(self):
return 400
@property
def message(self):
return "아이디 혹은 비밀번호가 옳바르지 않습니다."
class InvalidRequest(PilotException):
@property
def code(self):
return 400
@property
def message(self):
return "입력값을 확인해주세요."