Commit 300ceb8
fix(db): return empty arrays from all()/values() on readonly database
The readonly error handler used a bare `return` for all traced methods,
yielding `undefined` even for all() and values() which callers expect
to return arrays. This would crash on .map()/.length if a write query
ever used these methods (e.g. DELETE ... RETURNING *).
Extract handleReadonlyError() helper that returns [] for all/values
and undefined for run/get. Also reduces complexity in the proxy handler.1 parent b80b6d9 commit 300ceb8
2 files changed
+31
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
630 | 630 | | |
631 | 631 | | |
632 | 632 | | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
633 | 646 | | |
634 | 647 | | |
635 | 648 | | |
| |||
689 | 702 | | |
690 | 703 | | |
691 | 704 | | |
692 | | - | |
693 | | - | |
| 705 | + | |
694 | 706 | | |
695 | 707 | | |
696 | 708 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
808 | 808 | | |
809 | 809 | | |
810 | 810 | | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
811 | 828 | | |
812 | 829 | | |
813 | 830 | | |
| |||
0 commit comments