Replies: 1 comment 16 replies
-
I found use func main() {
var err error
logger := slog.With()
logger.Debug("add node")
defer err2.NilThen(&err, func() {
logger.Debug("add node successful")
})
defer err2.Handle(&err, func() { try.To(err) })
try.To(AddNode())
} |
Beta Was this translation helpful? Give feedback.
16 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
add
err2.NilThen
method and supporttry.Out(error).Handle(&err)
bind error to errI don't know much about ziglang
errdefer
anddefer
, but these api can give us a similar experience in golangI use the blow code now
Beta Was this translation helpful? Give feedback.
All reactions