class Index(VIew):
def post(self, request):
count = request.POST.get('count')
if int(count) < 10:
raise RuntimeError('CountSizeError') # 手動拋出異常
使用raise RuntimeError('CountSizeError')可以手動拋出一個RuntimeError異常,異常的名稱爲CountSizeError