Commit e8978eb
committed
Make status code and NGINX error codes on internalError publicly accessible
This will allow users of the plus client to check errors and decide what further action to take. This fix follows the advice of commentators who counsel users of go to assert errors for behavior, not type. https://dave.cheney.net/2014/12/24/inspecting-errors The user would create a simple error interface including Status() and Code() methods and then could use errors.As() to cast the internalError to their own interface type. For example, if the user attempts to delete an upstream server using the client, the user can check the error returned for a http.StatusNotFound code, and if present, can make their application take no further action. If some error status code is returned, then the user can retry the delete. Previously in order to perform this kind of analysis the user would have to resort to string checking on the error: never a good solution.1 parent 177be93 commit e8978eb
2 files changed
+72
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
116 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
117 | 127 | | |
118 | 128 | | |
119 | 129 | | |
| |||
1782 | 1792 | | |
1783 | 1793 | | |
1784 | 1794 | | |
1785 | | - | |
| 1795 | + | |
1786 | 1796 | | |
1787 | 1797 | | |
1788 | 1798 | | |
| |||
1808 | 1818 | | |
1809 | 1819 | | |
1810 | 1820 | | |
1811 | | - | |
| 1821 | + | |
1812 | 1822 | | |
1813 | 1823 | | |
1814 | 1824 | | |
| |||
1824 | 1834 | | |
1825 | 1835 | | |
1826 | 1836 | | |
1827 | | - | |
| 1837 | + | |
1828 | 1838 | | |
1829 | 1839 | | |
1830 | 1840 | | |
| |||
2137 | 2147 | | |
2138 | 2148 | | |
2139 | 2149 | | |
2140 | | - | |
| 2150 | + | |
2141 | 2151 | | |
2142 | 2152 | | |
2143 | 2153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
1438 | 1439 | | |
1439 | 1440 | | |
1440 | 1441 | | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
1441 | 1497 | | |
1442 | 1498 | | |
1443 | 1499 | | |
| |||
0 commit comments