Revize 445886fb
Přidáno uživatelem David Friesecký před téměř 4 roky(ů)
src/dao/certificate_repository.py | ||
---|---|---|
88 | 88 |
values = [last_id, usage_id] |
89 | 89 |
self.cursor.execute(sql, values) |
90 | 90 |
self.connection.commit() |
91 |
except IntegrityError: |
|
92 |
Logger.error(INTEGRITY_ERROR_MSG) |
|
93 |
raise DatabaseException(INTEGRITY_ERROR_MSG) |
|
94 |
except ProgrammingError: |
|
95 |
Logger.error(PROGRAMMING_ERROR_MSG) |
|
96 |
raise DatabaseException(PROGRAMMING_ERROR_MSG) |
|
97 |
except OperationalError as e: |
|
98 |
Logger.error(OPERATIONAL_ERROR_MSG) |
|
99 |
# TODO will be improved in #8884 |
|
91 |
|
|
92 |
except (IntegrityError, OperationalError, ProgrammingError, NotSupportedError, DatabaseError, Error) as e: |
|
100 | 93 |
Logger.error(str(e)) |
101 |
raise DatabaseException(OPERATIONAL_ERROR_MSG) |
|
102 |
except NotSupportedError: |
|
103 |
Logger.error(NOT_SUPPORTED_ERROR_MSG) |
|
104 |
raise DatabaseException(NOT_SUPPORTED_ERROR_MSG) |
|
105 |
except DatabaseError: |
|
106 |
Logger.error(DATABASE_ERROR_MSG) |
|
107 |
raise DatabaseException(DATABASE_ERROR_MSG) |
|
108 |
except Error: |
|
109 |
Logger.error(ERROR_MSG) |
|
110 |
raise DatabaseException(ERROR_MSG) |
|
94 |
raise DatabaseException(e) |
|
111 | 95 |
|
112 | 96 |
return last_id |
113 | 97 |
|
... | ... | |
159 | 143 |
certificate_row[11], # revocation date |
160 | 144 |
certificate_row[12]) # revocation reason |
161 | 145 |
|
162 |
except IntegrityError: |
|
163 |
Logger.error(INTEGRITY_ERROR_MSG) |
|
164 |
raise DatabaseException(INTEGRITY_ERROR_MSG) |
|
165 |
except ProgrammingError: |
|
166 |
Logger.error(PROGRAMMING_ERROR_MSG) |
|
167 |
raise DatabaseException(PROGRAMMING_ERROR_MSG) |
|
168 |
except OperationalError: |
|
169 |
Logger.error(OPERATIONAL_ERROR_MSG) |
|
170 |
raise DatabaseException(OPERATIONAL_ERROR_MSG) |
|
171 |
except NotSupportedError: |
|
172 |
Logger.error(NOT_SUPPORTED_ERROR_MSG) |
|
173 |
raise DatabaseException(NOT_SUPPORTED_ERROR_MSG) |
|
174 |
except DatabaseError: |
|
175 |
Logger.error(DATABASE_ERROR_MSG) |
|
176 |
raise DatabaseException(DATABASE_ERROR_MSG) |
|
177 |
except Error: |
|
178 |
Logger.error(ERROR_MSG) |
|
179 |
raise DatabaseException(ERROR_MSG) |
|
146 |
except (IntegrityError, OperationalError, ProgrammingError, NotSupportedError, DatabaseError, Error) as e: |
|
147 |
Logger.error(str(e)) |
|
148 |
raise DatabaseException(e) |
|
180 | 149 |
|
181 | 150 |
return certificate |
182 | 151 |
|
... | ... | |
233 | 202 |
certificate_row[10], # email address |
234 | 203 |
certificate_row[11], # revocation date |
235 | 204 |
certificate_row[12])) # revocation reason |
236 |
except IntegrityError: |
|
237 |
Logger.error(INTEGRITY_ERROR_MSG) |
|
238 |
raise DatabaseException(INTEGRITY_ERROR_MSG) |
|
239 |
except ProgrammingError: |
|
240 |
Logger.error(PROGRAMMING_ERROR_MSG) |
|
241 |
raise DatabaseException(PROGRAMMING_ERROR_MSG) |
|
242 |
except OperationalError: |
|
243 |
Logger.error(OPERATIONAL_ERROR_MSG) |
|
244 |
raise DatabaseException(OPERATIONAL_ERROR_MSG) |
|
245 |
except NotSupportedError: |
|
246 |
Logger.error(NOT_SUPPORTED_ERROR_MSG) |
|
247 |
raise DatabaseException(NOT_SUPPORTED_ERROR_MSG) |
|
248 |
except DatabaseError: |
|
249 |
Logger.error(DATABASE_ERROR_MSG) |
|
250 |
raise DatabaseException(DATABASE_ERROR_MSG) |
|
251 |
except Error: |
|
252 |
Logger.error(ERROR_MSG) |
|
253 |
raise DatabaseException(ERROR_MSG) |
|
205 |
|
|
206 |
except (IntegrityError, OperationalError, ProgrammingError, NotSupportedError, DatabaseError, Error) as e: |
|
207 |
Logger.error(str(e)) |
|
208 |
raise DatabaseException(e) |
|
254 | 209 |
|
255 | 210 |
return certificates |
256 | 211 |
|
... | ... | |
324 | 279 |
certificate_row[10], # email address |
325 | 280 |
certificate_row[11], # revocation date |
326 | 281 |
certificate_row[12])) # revocation reason |
327 |
except IntegrityError: |
|
328 |
Logger.error(INTEGRITY_ERROR_MSG) |
|
329 |
raise DatabaseException(INTEGRITY_ERROR_MSG) |
|
330 |
except ProgrammingError: |
|
331 |
Logger.error(PROGRAMMING_ERROR_MSG) |
|
332 |
raise DatabaseException(PROGRAMMING_ERROR_MSG) |
|
333 |
except OperationalError: |
|
334 |
Logger.error(OPERATIONAL_ERROR_MSG) |
|
335 |
raise DatabaseException(OPERATIONAL_ERROR_MSG) |
|
336 |
except NotSupportedError: |
|
337 |
Logger.error(NOT_SUPPORTED_ERROR_MSG) |
|
338 |
raise DatabaseException(NOT_SUPPORTED_ERROR_MSG) |
|
339 |
except DatabaseError: |
|
340 |
Logger.error(DATABASE_ERROR_MSG) |
|
341 |
raise DatabaseException(DATABASE_ERROR_MSG) |
|
342 |
except Error: |
|
343 |
Logger.error(ERROR_MSG) |
|
344 |
raise DatabaseException(ERROR_MSG) |
|
282 |
|
|
283 |
except (IntegrityError, OperationalError, ProgrammingError, NotSupportedError, DatabaseError, Error) as e: |
|
284 |
Logger.error(str(e)) |
|
285 |
raise DatabaseException(e) |
|
345 | 286 |
|
346 | 287 |
return certificates |
347 | 288 |
|
... | ... | |
411 | 352 |
values = [certificate_id, usage_id] |
412 | 353 |
self.cursor.execute(sql, values) |
413 | 354 |
self.connection.commit() |
414 |
except IntegrityError: |
|
415 |
Logger.error(INTEGRITY_ERROR_MSG) |
|
416 |
raise DatabaseException(INTEGRITY_ERROR_MSG) |
|
417 |
except ProgrammingError: |
|
418 |
Logger.error(PROGRAMMING_ERROR_MSG) |
|
419 |
raise DatabaseException(PROGRAMMING_ERROR_MSG) |
|
420 |
except OperationalError: |
|
421 |
Logger.error(OPERATIONAL_ERROR_MSG) |
|
422 |
raise DatabaseException(OPERATIONAL_ERROR_MSG) |
|
423 |
except NotSupportedError: |
|
424 |
Logger.error(NOT_SUPPORTED_ERROR_MSG) |
|
425 |
raise DatabaseException(NOT_SUPPORTED_ERROR_MSG) |
|
426 |
except DatabaseError: |
|
427 |
Logger.error(DATABASE_ERROR_MSG) |
|
428 |
raise DatabaseException(DATABASE_ERROR_MSG) |
|
429 |
except Error: |
|
430 |
Logger.error(ERROR_MSG) |
|
431 |
raise DatabaseException(ERROR_MSG) |
|
355 |
|
|
356 |
except (IntegrityError, OperationalError, ProgrammingError, NotSupportedError, DatabaseError, Error) as e: |
|
357 |
Logger.error(str(e)) |
|
358 |
raise DatabaseException(e) |
|
432 | 359 |
|
433 | 360 |
return check_updated |
434 | 361 |
|
... | ... | |
451 | 378 |
certificate_id] |
452 | 379 |
self.cursor.execute(sql, values) |
453 | 380 |
self.connection.commit() |
454 |
except IntegrityError: |
|
455 |
Logger.error(INTEGRITY_ERROR_MSG) |
|
456 |
raise DatabaseException(INTEGRITY_ERROR_MSG) |
|
457 |
except ProgrammingError: |
|
458 |
Logger.error(PROGRAMMING_ERROR_MSG) |
|
459 |
raise DatabaseException(PROGRAMMING_ERROR_MSG) |
|
460 |
except OperationalError: |
|
461 |
Logger.error(OPERATIONAL_ERROR_MSG) |
|
462 |
raise DatabaseException(OPERATIONAL_ERROR_MSG) |
|
463 |
except NotSupportedError: |
|
464 |
Logger.error(NOT_SUPPORTED_ERROR_MSG) |
|
465 |
raise DatabaseException(NOT_SUPPORTED_ERROR_MSG) |
|
466 |
except DatabaseError: |
|
467 |
Logger.error(DATABASE_ERROR_MSG) |
|
468 |
raise DatabaseException(DATABASE_ERROR_MSG) |
|
469 |
except Error: |
|
470 |
Logger.error(ERROR_MSG) |
|
471 |
raise DatabaseException(ERROR_MSG) |
|
381 |
|
|
382 |
except (IntegrityError, OperationalError, ProgrammingError, NotSupportedError, DatabaseError, Error) as e: |
|
383 |
Logger.error(str(e)) |
|
384 |
raise DatabaseException(e) |
|
472 | 385 |
|
473 | 386 |
return self.cursor.rowcount > 0 |
474 | 387 |
|
... | ... | |
503 | 416 |
certificate_id] |
504 | 417 |
self.cursor.execute(sql, values) |
505 | 418 |
self.connection.commit() |
506 |
except IntegrityError: |
|
507 |
Logger.error(INTEGRITY_ERROR_MSG) |
|
508 |
raise DatabaseException(INTEGRITY_ERROR_MSG) |
|
509 |
except ProgrammingError: |
|
510 |
Logger.error(PROGRAMMING_ERROR_MSG) |
|
511 |
raise DatabaseException(PROGRAMMING_ERROR_MSG) |
|
512 |
except OperationalError: |
|
513 |
Logger.error(OPERATIONAL_ERROR_MSG) |
|
514 |
raise DatabaseException(OPERATIONAL_ERROR_MSG) |
|
515 |
except NotSupportedError: |
|
516 |
Logger.error(NOT_SUPPORTED_ERROR_MSG) |
|
517 |
raise DatabaseException(NOT_SUPPORTED_ERROR_MSG) |
|
518 |
except DatabaseError: |
|
519 |
Logger.error(DATABASE_ERROR_MSG) |
|
520 |
raise DatabaseException(DATABASE_ERROR_MSG) |
|
521 |
except Error: |
|
522 |
Logger.error(ERROR_MSG) |
|
523 |
raise DatabaseException(ERROR_MSG) |
|
419 |
|
|
420 |
except (IntegrityError, OperationalError, ProgrammingError, NotSupportedError, DatabaseError, Error) as e: |
|
421 |
Logger.error(str(e)) |
|
422 |
raise DatabaseException(e) |
|
524 | 423 |
|
525 | 424 |
return self.cursor.rowcount > 0 |
526 | 425 |
|
... | ... | |
545 | 444 |
values = [certificate_id] |
546 | 445 |
self.cursor.execute(sql, values) |
547 | 446 |
self.connection.commit() |
548 |
except IntegrityError: |
|
549 |
Logger.error(INTEGRITY_ERROR_MSG) |
|
550 |
raise DatabaseException(INTEGRITY_ERROR_MSG) |
|
551 |
except ProgrammingError: |
|
552 |
Logger.error(PROGRAMMING_ERROR_MSG) |
|
553 |
raise DatabaseException(PROGRAMMING_ERROR_MSG) |
|
554 |
except OperationalError: |
|
555 |
Logger.error(OPERATIONAL_ERROR_MSG) |
|
556 |
raise DatabaseException(OPERATIONAL_ERROR_MSG) |
|
557 |
except NotSupportedError: |
|
558 |
Logger.error(NOT_SUPPORTED_ERROR_MSG) |
|
559 |
raise DatabaseException(NOT_SUPPORTED_ERROR_MSG) |
|
560 |
except DatabaseError: |
|
561 |
Logger.error(DATABASE_ERROR_MSG) |
|
562 |
raise DatabaseException(DATABASE_ERROR_MSG) |
|
563 |
except Error: |
|
564 |
Logger.error(ERROR_MSG) |
|
565 |
raise DatabaseException(ERROR_MSG) |
|
447 |
|
|
448 |
except (IntegrityError, OperationalError, ProgrammingError, NotSupportedError, DatabaseError, Error) as e: |
|
449 |
Logger.error(str(e)) |
|
450 |
raise DatabaseException(e) |
|
566 | 451 |
|
567 | 452 |
return self.cursor.rowcount > 0 |
568 | 453 |
|
... | ... | |
616 | 501 |
certificate_row[10], # email address |
617 | 502 |
certificate_row[11], # revocation date |
618 | 503 |
certificate_row[12])) # revocation reason |
619 |
except IntegrityError: |
|
620 |
Logger.error(INTEGRITY_ERROR_MSG) |
|
621 |
raise DatabaseException(INTEGRITY_ERROR_MSG) |
|
622 |
except ProgrammingError: |
|
623 |
Logger.error(PROGRAMMING_ERROR_MSG) |
|
624 |
raise DatabaseException(PROGRAMMING_ERROR_MSG) |
|
625 |
except OperationalError: |
|
626 |
Logger.error(OPERATIONAL_ERROR_MSG) |
|
627 |
raise DatabaseException(OPERATIONAL_ERROR_MSG) |
|
628 |
except NotSupportedError: |
|
629 |
Logger.error(NOT_SUPPORTED_ERROR_MSG) |
|
630 |
raise DatabaseException(NOT_SUPPORTED_ERROR_MSG) |
|
631 |
except DatabaseError: |
|
632 |
Logger.error(DATABASE_ERROR_MSG) |
|
633 |
raise DatabaseException(DATABASE_ERROR_MSG) |
|
634 |
except Error: |
|
635 |
Logger.error(ERROR_MSG) |
|
636 |
raise DatabaseException(ERROR_MSG) |
|
504 |
|
|
505 |
except (IntegrityError, OperationalError, ProgrammingError, NotSupportedError, DatabaseError, Error) as e: |
|
506 |
Logger.error(str(e)) |
|
507 |
raise DatabaseException(e) |
|
637 | 508 |
|
638 | 509 |
return certificates |
639 | 510 |
|
... | ... | |
688 | 559 |
certificate_row[10], # email address |
689 | 560 |
certificate_row[11], # revocation date |
690 | 561 |
certificate_row[12])) # revocation reason |
691 |
except IntegrityError: |
|
692 |
Logger.error(INTEGRITY_ERROR_MSG) |
|
693 |
raise DatabaseException(INTEGRITY_ERROR_MSG) |
|
694 |
except ProgrammingError: |
|
695 |
Logger.error(PROGRAMMING_ERROR_MSG) |
|
696 |
raise DatabaseException(PROGRAMMING_ERROR_MSG) |
|
697 |
except OperationalError: |
|
698 |
Logger.error(OPERATIONAL_ERROR_MSG) |
|
699 |
raise DatabaseException(OPERATIONAL_ERROR_MSG) |
|
700 |
except NotSupportedError: |
|
701 |
Logger.error(NOT_SUPPORTED_ERROR_MSG) |
|
702 |
raise DatabaseException(NOT_SUPPORTED_ERROR_MSG) |
|
703 |
except DatabaseError: |
|
704 |
Logger.error(DATABASE_ERROR_MSG) |
|
705 |
raise DatabaseException(DATABASE_ERROR_MSG) |
|
706 |
except Error: |
|
707 |
Logger.error(ERROR_MSG) |
|
708 |
raise DatabaseException(ERROR_MSG) |
|
562 |
|
|
563 |
except (IntegrityError, OperationalError, ProgrammingError, NotSupportedError, DatabaseError, Error) as e: |
|
564 |
Logger.error(str(e)) |
|
565 |
raise DatabaseException(e) |
|
709 | 566 |
|
710 | 567 |
return certificates |
711 | 568 |
|
... | ... | |
784 | 641 |
certificate_row[10], # email address |
785 | 642 |
certificate_row[11], # revocation date |
786 | 643 |
certificate_row[12])) # revocation reason |
787 |
except IntegrityError: |
|
788 |
Logger.error(INTEGRITY_ERROR_MSG) |
|
789 |
raise DatabaseException(INTEGRITY_ERROR_MSG) |
|
790 |
except ProgrammingError: |
|
791 |
Logger.error(PROGRAMMING_ERROR_MSG) |
|
792 |
raise DatabaseException(PROGRAMMING_ERROR_MSG) |
|
793 |
except OperationalError: |
|
794 |
Logger.error(OPERATIONAL_ERROR_MSG) |
|
795 |
raise DatabaseException(OPERATIONAL_ERROR_MSG) |
|
796 |
except NotSupportedError: |
|
797 |
Logger.error(NOT_SUPPORTED_ERROR_MSG) |
|
798 |
raise DatabaseException(NOT_SUPPORTED_ERROR_MSG) |
|
799 |
except DatabaseError: |
|
800 |
Logger.error(DATABASE_ERROR_MSG) |
|
801 |
raise DatabaseException(DATABASE_ERROR_MSG) |
|
802 |
except Error: |
|
803 |
Logger.error(ERROR_MSG) |
|
804 |
raise DatabaseException(ERROR_MSG) |
|
644 |
|
|
645 |
except (IntegrityError, OperationalError, ProgrammingError, NotSupportedError, DatabaseError, Error) as e: |
|
646 |
Logger.error(str(e)) |
|
647 |
raise DatabaseException(e) |
|
805 | 648 |
|
806 | 649 |
return certificates |
807 | 650 |
|
... | ... | |
827 | 670 |
|
828 | 671 |
all_certs = [] |
829 | 672 |
dfs(self.get_all_issued_by, subtree_root, all_certs) |
830 |
except IntegrityError: |
|
831 |
Logger.error(INTEGRITY_ERROR_MSG) |
|
832 |
raise DatabaseException(INTEGRITY_ERROR_MSG) |
|
833 |
except ProgrammingError: |
|
834 |
Logger.error(PROGRAMMING_ERROR_MSG) |
|
835 |
raise DatabaseException(PROGRAMMING_ERROR_MSG) |
|
836 |
except OperationalError: |
|
837 |
Logger.error(OPERATIONAL_ERROR_MSG) |
|
838 |
raise DatabaseException(OPERATIONAL_ERROR_MSG) |
|
839 |
except NotSupportedError: |
|
840 |
Logger.error(NOT_SUPPORTED_ERROR_MSG) |
|
841 |
raise DatabaseException(NOT_SUPPORTED_ERROR_MSG) |
|
842 |
except DatabaseError: |
|
843 |
Logger.error(DATABASE_ERROR_MSG) |
|
844 |
raise DatabaseException(DATABASE_ERROR_MSG) |
|
845 |
except Error: |
|
846 |
Logger.error(ERROR_MSG) |
|
847 |
raise DatabaseException(ERROR_MSG) |
|
673 |
|
|
674 |
except (IntegrityError, OperationalError, ProgrammingError, NotSupportedError, DatabaseError, Error) as e: |
|
675 |
Logger.error(str(e)) |
|
676 |
raise DatabaseException(e) |
|
848 | 677 |
|
849 | 678 |
return all_certs |
850 | 679 |
|
... | ... | |
866 | 695 |
if result[0] == TAB_CERTIFICATES: |
867 | 696 |
return result[1] + 1 # current last id + 1 |
868 | 697 |
# if certificates table is not present in the query results, return 1 |
869 |
except IntegrityError: |
|
870 |
Logger.error(INTEGRITY_ERROR_MSG) |
|
871 |
raise DatabaseException(INTEGRITY_ERROR_MSG) |
|
872 |
except ProgrammingError: |
|
873 |
Logger.error(PROGRAMMING_ERROR_MSG) |
|
874 |
raise DatabaseException(PROGRAMMING_ERROR_MSG) |
|
875 |
except OperationalError: |
|
876 |
Logger.error(OPERATIONAL_ERROR_MSG) |
|
877 |
raise DatabaseException(OPERATIONAL_ERROR_MSG) |
|
878 |
except NotSupportedError: |
|
879 |
Logger.error(NOT_SUPPORTED_ERROR_MSG) |
|
880 |
raise DatabaseException(NOT_SUPPORTED_ERROR_MSG) |
|
881 |
except DatabaseError: |
|
882 |
Logger.error(DATABASE_ERROR_MSG) |
|
883 |
raise DatabaseException(DATABASE_ERROR_MSG) |
|
884 |
except Error: |
|
885 |
Logger.error(ERROR_MSG) |
|
886 |
raise DatabaseException(ERROR_MSG) |
|
698 |
|
|
699 |
except (IntegrityError, OperationalError, ProgrammingError, NotSupportedError, DatabaseError, Error) as e: |
|
700 |
Logger.error(str(e)) |
|
701 |
raise DatabaseException(e) |
|
887 | 702 |
|
888 | 703 |
return 1 |
Také k dispozici: Unified diff
Re #8884 - Improved exceptions in repositories