Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
12243 Переглядів

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
8276
0
вер. 24
1343
1
бер. 15
10414
1
лист. 22
7351
0
черв. 21
6371