تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
12270 أدوات العرض

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
يوليو 22
8290
0
سبتمبر 24
1367
1
مارس 15
10425
1
نوفمبر 22
7363
0
يونيو 21
6390