Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
12254 Lượt xem

Hello Community,

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

Thanks.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 7 22
8283
0
thg 9 24
1347
1
thg 3 15
10417
1
thg 11 22
7357
0
thg 6 21
6377