File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed
Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -160,20 +160,21 @@ if SLACK_WEBHOOK_URL:
160160```
161161
162162
163- #### `SnackbarException `
163+ #### `SnackbarError `
164164
165165A little helper that when raised returns a JSON response to the user with a
166166snackbar message. This message is automatically rendered as a snackbar by
167167Skeletor.
168168
169169```py
170170# views.py
171- from ckc.exceptions import SnackbarException
171+ from ckc.exceptions import SnackbarError
172+
172173
173174class 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
Original file line number Diff line number Diff line change 11from 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 })
Original file line number Diff line number Diff line change 11from rest_framework .views import APIView
22
3- from ckc .exceptions import SnackbarException
3+ from ckc .exceptions import SnackbarError
44
55
66class 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' )
You can’t perform that action at this time.
0 commit comments