Commit c65eacb
committed
Refactor test error handling: fix blanket rescues and state threading
Two critical improvements to test/pool_load_test.exs:
1. Replace blanket rescue clauses with specific exception handling (lines 602-623, 695-722)
- Changed 'rescue _ -> :ok' to pattern match only ArgumentError and RuntimeError
- Unexpected exceptions are logged with ERROR level and re-raised for visibility
- Expected exceptions are logged with DEBUG level to aid troubleshooting
- Makes failures in close_stmt/1 immediately visible for debugging
- Added 'require Logger' to module
2. Add explicit error handling to state threading in transaction test (lines 848-879)
- Replaced implicit success assumption in Enum.reduce with Enum.reduce_while
- Now explicitly handles insert_edge_case_value/2 failures instead of letting MatchError occur
- Captures errors with context (insert_failed reason) instead of crashing
- Wrapped entire sequence in 'with' clause to handle errors from either inserts or commit
- Makes test failures clearer and prevents masking of real issues
Benefits:
- Unexpected exceptions now surface for debugging instead of being silently swallowed
- Test errors are more informative with explicit error capture and context
- Code is more maintainable by showing what exceptions are explicitly expected1 parent 4f61f06 commit c65eacb
1 file changed
Lines changed: 77 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
598 | 599 | | |
599 | 600 | | |
600 | 601 | | |
601 | | - | |
| 602 | + | |
602 | 603 | | |
603 | 604 | | |
604 | 605 | | |
605 | | - | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
606 | 623 | | |
607 | 624 | | |
608 | 625 | | |
| |||
678 | 695 | | |
679 | 696 | | |
680 | 697 | | |
681 | | - | |
| 698 | + | |
682 | 699 | | |
683 | 700 | | |
684 | 701 | | |
685 | | - | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
686 | 719 | | |
687 | 720 | | |
688 | | - | |
| 721 | + | |
689 | 722 | | |
690 | | - | |
691 | | - | |
692 | | - | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
693 | 726 | | |
694 | | - | |
| 727 | + | |
695 | 728 | | |
696 | | - | |
697 | | - | |
698 | | - | |
699 | | - | |
700 | | - | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
701 | 734 | | |
702 | 735 | | |
703 | 736 | | |
| |||
812 | 845 | | |
813 | 846 | | |
814 | 847 | | |
815 | | - | |
816 | | - | |
817 | | - | |
818 | | - | |
819 | | - | |
820 | | - | |
821 | | - | |
822 | | - | |
823 | | - | |
824 | | - | |
825 | | - | |
826 | | - | |
827 | | - | |
828 | | - | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
829 | 877 | | |
830 | | - | |
| 878 | + | |
831 | 879 | | |
832 | 880 | | |
833 | 881 | | |
| |||
0 commit comments