Uh oh!
There was an error while loading. Please reload this page.
add AsOfType helper fn - #15
Conversation
| } | ||
| } | ||
| func AsOfType[T error](err error) (T, bool) { |
There was a problem hiding this comment.
IsOfType reads okay but AsOfType is a bit dense & grammatically weird, how about AsType?
| funcAsOfType[Terror](errerror) (T, bool) { | |
| funcAsType[Terror](errerror) (T, bool) { |
There was a problem hiding this comment.
I'm torn, this is nice, but we already have a IsOfType and not IsType. In that case, I prefer to let consistency win here
There was a problem hiding this comment.
Consistency kinda fucks over grammar here, which is why I prefer AsType. IsOfType is valid cos it means the error is of a given type, IsType would be wrong because it's an error, not a type.
AsOfType just doesn't mean anything in English, so consistency will really hurt readability here imo
There was a problem hiding this comment.
Alright, it won't have been the first time we mess with grammar in IT though 😄
682336a to
83cd99bCompare| } | ||
| } | ||
| func TestAsOfType(t *testing.T) { |
There was a problem hiding this comment.
nit:
| funcTestAsOfType(t*testing.T) { | |
| funcTestAsType(t*testing.T) { |
83cd99b to
a4f2a9bCompareUh oh!
There was an error while loading. Please reload this page.
What does this PR do?
Add a new helper to
Aserrors without having to instanciate a variable beforehandGood PR checklist