Browse Source

Exceptions enhancement in LeObject

Yann Weber 8 years ago
parent
commit
7f2246756d
2 changed files with 7 additions and 2 deletions
  1. 5
    0
      lodel/leapi/exceptions.py
  2. 2
    2
      lodel/leapi/leobject.py

+ 5
- 0
lodel/leapi/exceptions.py View File

16
     pass
16
     pass
17
 
17
 
18
 
18
 
19
+class LeApiDataCheckErrors(LodelExceptions, LeApiError):
20
+    pass
21
+
22
+
19
 class LeApiQueryError(LeApiError):
23
 class LeApiQueryError(LeApiError):
20
     pass
24
     pass
21
 
25
 
23
 ##@brief Handles mulitple query errors
27
 ##@brief Handles mulitple query errors
24
 class LeApiQueryErrors(LodelExceptions, LeApiQueryError):
28
 class LeApiQueryErrors(LodelExceptions, LeApiQueryError):
25
     pass
29
     pass
30
+

+ 2
- 2
lodel/leapi/leobject.py View File

400
             err_l[u_f] = AttributeError("Unknown or unauthorized field '%s'" % u_f)
400
             err_l[u_f] = AttributeError("Unknown or unauthorized field '%s'" % u_f)
401
         # searching for missing mandatory fieldsa
401
         # searching for missing mandatory fieldsa
402
         for missing in mandatory - provided:
402
         for missing in mandatory - provided:
403
-            err_l[miss_field] = AttributeError("The data for field '%s' is missing" % missing)
403
+            err_l[missing] = AttributeError("The data for field '%s' is missing" % missing)
404
         #Checks datas
404
         #Checks datas
405
         checked_datas = dict()
405
         checked_datas = dict()
406
         for name, value in [ (name, value) for name, value in datas.items() if name in correct ]:
406
         for name, value in [ (name, value) for name, value in datas.items() if name in correct ]:
411
                 err_l[name] = err
411
                 err_l[name] = err
412
 
412
 
413
         if len(err_l) > 0:
413
         if len(err_l) > 0:
414
-            raise LeApiDataCheckError("Error while checking datas", err_l)
414
+            raise LeApiDataCheckErrors("Error while checking datas", err_l)
415
         return checked_datas
415
         return checked_datas
416
 
416
 
417
     ##@brief Check and prepare datas
417
     ##@brief Check and prepare datas

Loading…
Cancel
Save