Django手动抛出异常
class Index(VIew): def post(self, request): count = request.POST.get('count') if int(count) < 10: raise RuntimeError('CountSizeError') # 手动抛出异常
使用raise RuntimeError('CountSizeError')可以手动抛出一个RuntimeError异常,异常的名称为CountSizeError
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。