Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
12219 มุมมอง

Hello Community,

What is the diffrence between ValidationError and UserError when we want to show an error message ?

Thanks.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

ValidationError is explained very briefly in the source code (linked by Nijas Raphy) like this

class ValidationError(except_orm):
""" Violation of python constraints
Example: When you try to create a new user with a login which already exist in the db."""
def __init__(self, msg):
super(ValidationError, self).__init__(msg)


UserError is not really explained at all, but you can search the source code for examples (directly on github or do a "git grep UserError" if you have the repo locally which I highly recommend) and it will give you an idea.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.ค. 22
8263
0
ก.ย. 24
1335
1
มี.ค. 15
10398
1
พ.ย. 22
7343
0
มิ.ย. 21
6367