python - 关于flask中自定义ValidationError的疑问
PHPz
PHPz 2017-04-17 17:37:00
0
2
340

此处ValidationError为何不直接使用ValueError?
谢谢~

PHPz
PHPz

学习是最好的投资!

reply all(2)
Ty80

Let’s put it this way, mainly for the sake of friendliness, you use ValueError自然是可以的,但是在抛出异常的时候,我们只知道是值错误,至于为什么会出现错误呢,我们利用ValidationError继承ValueError异常类的来告知,这里是验证错误

Ty80

Customize exceptions to make the meaning of exceptions clearer.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template