Commit 59d5c2e
chore(govdao): improve error handling in Render (#4910)
Fix: #4629
Add more checks, fix interface call on nil, and enhance error messages
in GovDAO to create a more user-friendly experience.
I didn't add second check on `GetStatus` return value, as it should
never be triggered.
I'm not sure the `getPropStatus` UNKNOWN status can be executed, but
it's always great to have.
## Tests
#### Prerequisites
```
// Install gno
gnodev . // In any directory
```
### DAO not initialized
- http://127.0.0.1:8888/r/gov/dao/v3/impl:1000
<img width="1190" height="618" alt="image"
src="https://github.com/user-attachments/assets/aef433fa-f3eb-4948-9d34-dd20aaebc3c2"
/>
### Invalid proposal
For the next tests, you should load
http://127.0.0.1:8888/r/gov/dao/v3/loader before executing the test to
initialize the DAO.
- "No proposals yet." - http://127.0.0.1:8888/r/gov/dao/v3/impl
<img width="1324" height="956" alt="image"
src="https://github.com/user-attachments/assets/d8f6135a-a190-4518-8bf8-b1e092fa5dbf"
/>
- "Error: Invalid proposal ID format." -
http://127.0.0.1:8888/r/gov/dao/v3/impl:100a
<img width="1390" height="524" alt="image"
src="https://github.com/user-attachments/assets/3a37eeed-def0-446e-aad5-3b389eecb23c"
/>
- "Proposal not found" - http://127.0.0.1:8888/r/gov/dao/v3/impl:1000
<img width="1222" height="536" alt="image"
src="https://github.com/user-attachments/assets/b4031c5c-8713-41ec-ac55-c90034ac0893"
/>
---------
Co-authored-by: Manfred Touron <[email protected]>1 parent a2c8e1d commit 59d5c2e
File tree
3 files changed
+49
-9
lines changed- examples/gno.land/r/gov/dao
- v3/impl
3 files changed
+49
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
46 | 52 | | |
47 | 53 | | |
48 | 54 | | |
| |||
64 | 70 | | |
65 | 71 | | |
66 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
67 | 76 | | |
68 | 77 | | |
69 | 78 | | |
| |||
97 | 106 | | |
98 | 107 | | |
99 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
100 | 112 | | |
101 | 113 | | |
102 | 114 | | |
| |||
119 | 131 | | |
120 | 132 | | |
121 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
122 | 137 | | |
123 | 138 | | |
124 | 139 | | |
125 | 140 | | |
126 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
127 | 145 | | |
128 | 146 | | |
129 | 147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
64 | 69 | | |
65 | 70 | | |
66 | 71 | | |
67 | | - | |
| 72 | + | |
68 | 73 | | |
69 | 74 | | |
70 | 75 | | |
| |||
78 | 83 | | |
79 | 84 | | |
80 | 85 | | |
81 | | - | |
| 86 | + | |
82 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
83 | 94 | | |
84 | | - | |
85 | 95 | | |
86 | 96 | | |
87 | 97 | | |
| |||
102 | 112 | | |
103 | 113 | | |
104 | 114 | | |
105 | | - | |
| 115 | + | |
106 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
107 | 123 | | |
108 | | - | |
109 | 124 | | |
110 | 125 | | |
111 | 126 | | |
| |||
122 | 137 | | |
123 | 138 | | |
124 | 139 | | |
125 | | - | |
| 140 | + | |
126 | 141 | | |
| 142 | + | |
127 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
128 | 147 | | |
129 | 148 | | |
130 | 149 | | |
| |||
138 | 157 | | |
139 | 158 | | |
140 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
141 | 163 | | |
142 | 164 | | |
143 | 165 | | |
| |||
0 commit comments