Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
12223 Zobrazení

Hello Community,

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

Thanks.

Avatar
Zrušit
Nejlepší odpověď

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.

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
čvc 22
8265
0
zář 24
1335
1
bře 15
10399
1
lis 22
7343
0
čvn 21
6368