跳至內容
選單
此問題已被標幟
2 回覆
12319 瀏覽次數

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.

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
7月 22
8340
0
9月 24
1403
1
3月 15
10454
1
11月 22
7429
0
6月 21
6444