Andrew Bonventre | c0526c3 | 2018-08-28 09:55:58 -0600 | [diff] [blame] | 1 | # Go 2 Error Handling Feedback |
| 2 | |
| 3 | This page is meant to collect and organize feedback about the Go 2 [error handling draft design](https://go.googlesource.com/proposal/+/master/design/go2draft-error-handling-overview.md). |
| 4 | |
| 5 | Please post feedback on your blog, Medium, GitHub Gists, mailing lists, Google Docs, etc. And then please link it here. |
| 6 | |
Greg Weber | 003ae11 | 2018-09-04 11:44:23 -0700 | [diff] [blame] | 7 | Please help categorize the rest of the uncategorized proposals at the bottom. |
Greg Weber | c240ea2 | 2018-09-04 11:17:32 -0700 | [diff] [blame] | 8 | |
Liam | 94dc4cc | 2018-09-23 17:52:29 -0700 | [diff] [blame] | 9 | # Requirements |
| 10 | |
| 11 | Discussions of the requirements for a new error handling method. |
| 12 | |
| 13 | - Liam Breck, “[Requirements to Consider for Go 2 Error Handling](https://gist.github.com/networkimprov/961c9caa2631ad3b95413f7d44a2c98a)”, September 2018 |
| 14 | |
| 15 | - Ian Lance Taylor, “[Incomplete list of criteria](https://github.com/golang/go/issues/21161#issuecomment-389380686)” from GitHub proposal discussion, May 2018 |
Greg Weber | c240ea2 | 2018-09-04 11:17:32 -0700 | [diff] [blame] | 16 | |
Greg Weber | ca446d7 | 2018-09-04 11:46:26 -0700 | [diff] [blame] | 17 | # In support |
| 18 | |
| 19 | This includes supporting the existing chaining/stacking of handlers without changes. |
Greg Weber | 003ae11 | 2018-09-04 11:44:23 -0700 | [diff] [blame] | 20 | |
| 21 | - Jeffrey Koehler, “[In support of Handle Chaining; On Check](https://gist.github.com/deef0000dragon1/eb224ce4918d4ec3bdbaedf83a32aeb1)”, August 2018 |
| 22 | |
| 23 | - Adam Bouhenguel "[In support of more declarative error handling](https://gist.github.com/ajbouh/716f8daba40199fe4d4d702704f3dfcc)", August 2018 |
| 24 | |
| 25 | - Daniel Theophanes, "[Go 2 Design: Error Handling Net Win](https://docs.google.com/document/d/e/2PACX-1vSq487dLylRHjgtKV42EbTKHW1aHZaaso3MZ4HOG1OS-s8suOnR9WZz6ahzH4Kufs2vwKKDMhoj1_I6/pub)", August 2018 |
| 26 | |
Greg Weber | fa0c36b | 2018-09-04 11:51:06 -0700 | [diff] [blame] | 27 | # Example code |
| 28 | |
| 29 | Code changed to use the existing proposal. |
| 30 | |
| 31 | - Mateusz Czapliński, "[Converting a fragment of real code with error handling to Go 2 'design draft'](https://gist.github.com/akavel/62d90bdc43088574c638eb3b16301a92)", August 2018 |
| 32 | |
Liam | da33a7f | 2018-09-22 08:14:45 -0700 | [diff] [blame] | 33 | - Blake Mizerany, “[How best to account for partial writes when using check/handle?](https://gist.github.com/bmizerany/fcd0348bda96edce05a4fc7426e47751)”, August 2018 |
| 34 | |
Greg Weber | ca446d7 | 2018-09-04 11:46:26 -0700 | [diff] [blame] | 35 | |
Greg Weber | 003ae11 | 2018-09-04 11:44:23 -0700 | [diff] [blame] | 36 | # Against |
| 37 | |
Liam | 3dc1029 | 2018-09-08 14:04:29 -0700 | [diff] [blame] | 38 | Critiques without counter-proposals |
Greg Weber | ca446d7 | 2018-09-04 11:46:26 -0700 | [diff] [blame] | 39 | |
Liam | 3dc1029 | 2018-09-08 14:04:29 -0700 | [diff] [blame] | 40 | - Liam Breck, “[Golang, How dare you handle my checks!](https://medium.com/@mnmnotmail/golang-how-dare-you-handle-my-checks-d5485f991289)”, September 2018 |
Greg Weber | ca446d7 | 2018-09-04 11:46:26 -0700 | [diff] [blame] | 41 | |
Nate Finch | 789f0ea | 2018-09-10 16:05:38 -0400 | [diff] [blame] | 42 | - Nate Finch, "[Handle and Check, Let's Not](https://npf.io/2018/09/check-and-handle/)", September 2018 |
| 43 | |
Andrew W. Phillips | b84ccd4 | 2018-09-13 20:21:24 +1000 | [diff] [blame] | 44 | - Shannon Wynter "[Error Handling as it can already be done](https://gist.github.com/freman/0b372e46c72f6a27652538b9930ee851)", August 2018 |
| 45 | |
Greg Weber | 003ae11 | 2018-09-04 11:44:23 -0700 | [diff] [blame] | 46 | # Counter-proposals |
| 47 | |
Greg Weber | c240ea2 | 2018-09-04 11:17:32 -0700 | [diff] [blame] | 48 | ## Error handling with normal functions |
morikuni | 2b3ff32 | 2018-09-29 13:18:59 +0900 | [diff] [blame] | 49 | |
| 50 | - Taihei Morikuni, "[Use functions as an error handler, Add syntactic sugar to remove duplicated if statement](https://gist.github.com/morikuni/bbe4b2b0384507b42e6a79d4eca5fc61)", September 2018 |
| 51 | |
Viktor Kojouharov | bcf57bc | 2018-09-14 16:29:10 +0300 | [diff] [blame] | 52 | - Viktor Kojouharov, "[Reducing the special casing around the new error design draft](https://gist.github.com/urandom/6519990ef9eb7547e888a5f2da7f1a93)", September 2018 |
Greg Weber | c240ea2 | 2018-09-04 11:17:32 -0700 | [diff] [blame] | 53 | |
Scott Pakin | 90e7816 | 2018-09-13 10:02:23 -0600 | [diff] [blame] | 54 | - Scott Pakin, "[Go 2 error handling based on non-local returns](https://gist.github.com/spakin/86ea86ca48aefc78b672636914f4fc23)", September 2018 |
| 55 | |
| 56 | - Aleksei Pavliukov, “[Use a function as a handle parameter](https://github.com/a5i/go-proposal/blob/master/use%20a%20function%20as%20a%20handle%20parameter.md)”, September 2018 |
Liam | 79cb58b | 2018-09-13 01:40:56 -0700 | [diff] [blame] | 57 | |
Greg Weber | d5bf64d | 2018-09-10 04:57:01 -0700 | [diff] [blame] | 58 | - Greg Weber "[Error handling with functions and an error return?](https://github.com/golang/go/issues/27567)", September 2018. Originally linked [gist](https://gist.github.com/gregwebs/02479eeef8082cd199d9e6461cd1dab3). |
Greg Weber | c240ea2 | 2018-09-04 11:17:32 -0700 | [diff] [blame] | 59 | |
| 60 | - Gigi Sayfan, “[Go 2 error handling feedback + alternative solution](https://gist.github.com/the-gigi/3c1acfc521d7991309eec140f40ccc2b)", September 2018 |
| 61 | |
阮坤良 | 354a4d2 | 2018-09-05 17:43:42 +0800 | [diff] [blame] | 62 | - Ruan Kunliang, "[Simple Error Handling for Go 2](https://gist.github.com/PeterRK/4f59579c1162cdbc28086f6b5f7b4fa2)", August 2018 |
Greg Weber | c240ea2 | 2018-09-04 11:17:32 -0700 | [diff] [blame] | 63 | |
| 64 | ## Labeled error handlers |
| 65 | |
| 66 | - John Forstmeier, "[Labeled error handling](https://gist.github.com/forstmeier/b6c6a6d2f6f2f72a81a076322959c959)", September 2018 |
| 67 | |
| 68 | - Mikaël Cluseau, "[Multiple handlers, unambiguous on which return value is used](https://gist.github.com/mcluseau/1c20c3973fa3acb544d0505637be8d67)", September 2018 |
| 69 | |
Liam | 9296948 | 2018-09-08 14:12:14 -0700 | [diff] [blame] | 70 | - Liam Breck, “[The `#id/catch` Error Model](https://github.com/golang/go/issues/27519)”, September 2018 |
Greg Weber | c240ea2 | 2018-09-04 11:17:32 -0700 | [diff] [blame] | 71 | |
| 72 | |
| 73 | ## Inlining |
| 74 | |
| 75 | - Vlad Didenko, “[Error Handling with `grab | name()`](https://didenko.github.io/grab/grab_worth_it_0.1.1.html)”, November 2017 |
| 76 | |
Greg Weber | 5e3dea2 | 2018-09-04 11:38:31 -0700 | [diff] [blame] | 77 | - Gooid, “[Inline style error handle(simple unambiguous)](https://github.com/gooid/gonotes/blob/master/inline_style_error_handle.md)”, August 2018 |
| 78 | |
Greg Weber | c240ea2 | 2018-09-04 11:17:32 -0700 | [diff] [blame] | 79 | |
Greg Weber | c240ea2 | 2018-09-04 11:17:32 -0700 | [diff] [blame] | 80 | ## Just remove chaining/stacking |
| 81 | |
| 82 | - Alessandro Arzilli, “[Against check as an operator and handler chains](https://gist.github.com/aarzilli/1a85db632edecc8159505e2c785882ed)”, August 2018 |
| 83 | |
阮坤良 | 02cd623 | 2018-09-09 18:44:11 +0800 | [diff] [blame] | 84 | - Simon Howard, “[Go 2 errors response: One Handler Per Function](https://gist.github.com/fragglet/df6c5471771d87b2ad597d2efc57cb3e)”, August 2018 |
Greg Weber | 5e3dea2 | 2018-09-04 11:38:31 -0700 | [diff] [blame] | 85 | |
Andrew W. Phillips | 21c1cd7 | 2018-09-13 19:56:57 +1000 | [diff] [blame] | 86 | - Andrew Phillips, “[Improving Go Error Handling](http://devmethodologies.blogspot.com/2017/10/improving-go-error-handling.html)”, October 2017 |
| 87 | |
Eli Bendersky | 9d128cd | 2018-09-14 15:11:15 -0700 | [diff] [blame] | 88 | - Eli Bendersky, "[Thoughts on the Go 2 Error Handling proposal](https://gist.github.com/eliben/d0c872054864bfc1110ec761c3c53c47)", September 2018 |
Eli Bendersky | b9ca51d | 2018-09-14 15:10:54 -0700 | [diff] [blame] | 89 | |
Yoshiki Shibukawa | a639230 | 2018-09-28 02:19:18 +0900 | [diff] [blame] | 90 | - Yoshiki Shibukawa, "[Every handles should have return statement](https://gist.github.com/shibukawa/42a9dee400c2f8577b4a763bcb1a5e5f)", September 2018 |
| 91 | |
Greg Weber | 5e3dea2 | 2018-09-04 11:38:31 -0700 | [diff] [blame] | 92 | ## Use defer |
| 93 | |
| 94 | - Victoria Raymond, “[Force 'check' to return error instead of allowing customized logic](https://gist.github.com/VictoriaRaymond/d70663a6ec6cdc59816b8806dccf7826)”, August 2018 |
| 95 | |
| 96 | - Night-walker and daokoder, "[Extend and repurpose defer instead of introducing new syntax](https://github.com/daokoder/dao/issues/191#issuecomment-44784919 )", June 2014 |
| 97 | |
Greg Weber | 003ae11 | 2018-09-04 11:44:23 -0700 | [diff] [blame] | 98 | ## try/catch/finally syntax |
| 99 | |
Liam | 423c88f | 2018-09-27 01:25:43 -0700 | [diff] [blame] | 100 | - Kiura Magomadov, “[Addition to Go2 draft error handling](https://gist.github.com/Kiura/4826db047e22b7720d378ac9ac642027)", September 2018 |
| 101 | |
Liam | da33a7f | 2018-09-22 08:14:45 -0700 | [diff] [blame] | 102 | - ZhiFeng Hu, "[[Go2ErrorHandling] Go should support Exception handler](https://www.netroby.com/view/3910)", August 2018 |
| 103 | |
Greg Weber | 003ae11 | 2018-09-04 11:44:23 -0700 | [diff] [blame] | 104 | - Jan Semmelink, “[if-else-undo-done](https://gist.github.com/jansemmelink/235228a0fb56d0eeba8085ab5f8178f3)”, August 2018 |
Greg Weber | 5e3dea2 | 2018-09-04 11:38:31 -0700 | [diff] [blame] | 105 | |
Vladimir | 9935ba0 | 2018-09-30 21:35:42 +0300 | [diff] [blame] | 106 | - Vladimir Utoplov, "[Handling throws/throw idiom](https://gist.github.com/trashgenerator/d58e05522d2f83709e1a601564b68fee)", September 2018 |
| 107 | |
Greg Weber | c240ea2 | 2018-09-04 11:17:32 -0700 | [diff] [blame] | 108 | ## Other |
Andrew Bonventre | c0526c3 | 2018-08-28 09:55:58 -0600 | [diff] [blame] | 109 | |
DeedleFake | 786866a | 2018-09-21 18:41:56 -0400 | [diff] [blame] | 110 | - DeedleFake, "[Possible Solution to `check` Awkwardness with Chained Method Calls](https://gist.github.com/DeedleFake/5e8e9e39203dff4839793981f79123aa)", September 2018 |
| 111 | |
Fedir RYKHTIK | e8f7bb7 | 2018-09-12 19:25:34 +0200 | [diff] [blame] | 112 | - Fedir RYKHTIK, "[Go 2 error handling with exclamation mark](https://gist.github.com/fedir/50158bc351b43378b829948290102470)", September 2018 |
| 113 | |
jimmyfrasche | a69e19f | 2018-09-06 09:37:58 -0700 | [diff] [blame] | 114 | - jimmyfrasche, "[Don't special case error or nil](https://gist.github.com/jimmyfrasche/f2cd6aff16db5e46c577da44ec0cfa72)", September 2018 |
| 115 | |
Einthusan Vigneswaran | e594fd9 | 2018-08-31 19:10:01 -0400 | [diff] [blame] | 116 | - Einthusan Vigneswaran, “[Error Aware Keywords - return, defer, if, != and forcing the error object to be the last argument](https://gist.github.com/einthusan/24e18f6359a31b3537815284cde0f6de)”, September 2018 |
Einthusan Vigneswaran | d142356 | 2018-08-31 18:54:45 -0400 | [diff] [blame] | 117 | |
K. Alex Mills | d305d0a | 2018-09-02 10:30:01 -0500 | [diff] [blame] | 118 | - Jozef Slezak, "[Use semicolons instead of new keywords: check+handle](https://gist.github.com/jozef-slezak/93a7d9d3d18d3fce3f8c3990c031f8d0)", September 2018 |
| 119 | |
| 120 | - Loki Verloren, “[Go 2 error handling feedback and my thoughts on how to improve programmer's efficiency and experience](https://gist.github.com/l0k1verloren/8aec03b8c48fdb5d3dab3a77153ce162)”, September 2018 |
| 121 | |
Greg Weber | c240ea2 | 2018-09-04 11:17:32 -0700 | [diff] [blame] | 122 | ## Uncategorized |
K. Alex Mills | d305d0a | 2018-09-02 10:30:01 -0500 | [diff] [blame] | 123 | |
Greg Weber | c240ea2 | 2018-09-04 11:17:32 -0700 | [diff] [blame] | 124 | Please help categorize the rest of the proposals here. |
K. Alex Mills | d305d0a | 2018-09-02 10:30:01 -0500 | [diff] [blame] | 125 | |
deef | d26e537 | 2018-08-28 17:36:39 -0500 | [diff] [blame] | 126 | |
Adam Bouhenguel | 6048d34 | 2018-08-28 17:23:29 -0700 | [diff] [blame] | 127 | |
mattdee123 | bded86f | 2018-08-28 22:03:55 -0400 | [diff] [blame] | 128 | - Matt Dee "[Error Handling Should Support Custom Error Types](https://gist.github.com/mattdee123/a04f95ef5639489668cafd9c3b675a8c)", August 2018 |
mattdee123 | 2ea76da | 2018-08-28 21:53:19 -0400 | [diff] [blame] | 129 | |
DeedleFake | 73906fd | 2018-08-29 02:04:27 -0400 | [diff] [blame] | 130 | - DeedleFake, "[Feedback for Go 2 Design Drafts](https://deedlefake.com/2018/08/feedback-for-go-2-design-drafts/)", August 2018 |
Mateusz Czapliński | 91134a9 | 2018-08-29 12:36:50 +0000 | [diff] [blame] | 131 | |
pborman | ca5c4aa | 2018-08-29 08:11:20 -0500 | [diff] [blame] | 132 | - Paul Borman, “[Arguments against the Go 2 error handling proposal](https://gist.github.com/pborman/c69e79690d86dfc5c371f096be22930c)", August 2018 |
pborman | 4c3a591 | 2018-08-29 08:10:53 -0500 | [diff] [blame] | 133 | |
Savino Pio Liguori | 16f37f2 | 2018-08-29 17:22:59 +0200 | [diff] [blame] | 134 | - Savino Pio Liguori, "[Feedback for Go2 error handling design](https://gist.github.com/8lall0/cb43e1fa4aae42bc709b138bda02284e)", August 2018 |
| 135 | |
Yaowen Hu | 83a31e6 | 2018-08-30 10:44:06 +0800 | [diff] [blame] | 136 | - Garrus, "[Another style of syntactic sugar on error handling](https://gist.github.com/garrus/5b1f73a7640726c92273700eabed9056)", August 2018 |
| 137 | |
chef | 4457591 | 2018-08-30 18:53:40 +0800 | [diff] [blame] | 138 | - Marlon Che, "[How about separating check and handle?](https://gist.github.com/marlonche/4e5d4e5aec0555958ec1f181991325f6)", August 2018 |
| 139 | |
alnkapa | 0ddc88f | 2018-09-06 10:03:51 +0300 | [diff] [blame] | 140 | |
alnkapa | 3b07080 | 2018-08-30 16:27:00 +0300 | [diff] [blame] | 141 | |
Patrick Kelly | bfedd32 | 2018-08-30 11:35:30 -0600 | [diff] [blame] | 142 | - Patrick Kelly, "[handling more than just errors in go](https://medium.com/@phlatphrog/handling-more-than-just-errors-in-go-f97c5aa2eac4)", August 2018 |
| 143 | |
yesuu | b887cf5 | 2018-09-07 22:20:05 +0800 | [diff] [blame] | 144 | - Yesuu Zhang, "[Pass the check and handle parameters, custom handle](https://github.com/yesuu/go-proposal/blob/master/go2errorhanding.md)", September 2018 |
Greg Weber | 5e3dea2 | 2018-09-04 11:38:31 -0700 | [diff] [blame] | 145 | |
dumblob | bab5e3a | 2018-09-02 18:23:04 +0200 | [diff] [blame] | 146 | |
K. Alex Mills | 2ade452 | 2018-09-02 15:28:01 -0500 | [diff] [blame] | 147 | ## Adding Your Feedback |
| 148 | |
| 149 | Please format all entries as below. |
| 150 | |
Liam | f4d4e2c | 2018-08-31 01:32:52 -0700 | [diff] [blame] | 151 | - _Your Name_, “[_Title_](#URL)”, _month year_ |
| 152 | |
DeedleFake | 786866a | 2018-09-21 18:41:56 -0400 | [diff] [blame] | 153 | To make it easier to see new feedback, please add your new proposal to the top of the section it is placed in. |