Skip to content

Commit 975a4f4

Browse files
committed
rename SnackbarException -> SnackbarError
1 parent 985500b commit 975a4f4

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,20 +160,21 @@ if SLACK_WEBHOOK_URL:
160160
```
161161
162162
163-
#### `SnackbarException`
163+
#### `SnackbarError`
164164
165165
A little helper that when raised returns a JSON response to the user with a
166166
snackbar message. This message is automatically rendered as a snackbar by
167167
Skeletor.
168168
169169
```py
170170
# views.py
171-
from ckc.exceptions import SnackbarException
171+
from ckc.exceptions import SnackbarError
172+
172173
173174
class TestExceptionsViewSet(APIView):
174175
def get(self, request, *args, **kwargs):
175176
# This will return {"snackbar_message": "Something went wrong"}
176-
raise SnackbarException("Something went wrong")
177+
raise SnackbarError("Something went wrong")
177178
```
178179
179180
#### `./manage.py` commands

ckc/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from rest_framework.exceptions import ValidationError
22

33

4-
class SnackbarException(ValidationError):
4+
class SnackbarError(ValidationError):
55
def __init__(self, message):
66
super().__init__({'snackbar_message': message})

testproject/testapp/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from rest_framework.views import APIView
22

3-
from ckc.exceptions import SnackbarException
3+
from ckc.exceptions import SnackbarError
44

55

66
class TestExceptionsViewSet(APIView):
77
def get(self, request, *args, **kwargs):
8-
raise SnackbarException('This is a test exception')
8+
raise SnackbarError('This is a test exception')

0 commit comments

Comments
 (0)