TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Eris – A better way to handle, trace, and log errors in Go

137 pointsby sum2000over 5 years ago

9 comments

awinter-pyover 5 years ago
Have spent a while in the py&#x2F;js world but have switched to rust&#x2F;go for part of this year -- biggest change is boilerplate relating to error handling.<p>Automatic stack capture for exceptions is something my language could conceivably do on my behalf.<p>Writing even 3 lines of code per function to propogate up the error is a huge pain, especially because it pollutes the return type -- MustWhatever() in go is <i>much</i> easier to use than Whatever() returning (type, err)
评论 #21882050 未加载
评论 #21881016 未加载
评论 #21881036 未加载
评论 #21881143 未加载
评论 #21882543 未加载
bouncycastleover 5 years ago
I think a lot of programmers (and languages) confuse errors and exceptions. In most cases, errors should be expected, like an End Of File error or socket disconnect error, they aren&#x27;t really exceptions. You don&#x27;t really want a stack trace if an EOF happens, so you? When there really is an exception, why not just use panic and let it bubble up?
评论 #21882237 未加载
评论 #21882292 未加载
评论 #21882242 未加载
评论 #21882251 未加载
morningveraover 5 years ago
My friend and I have been working on eris for a while and we’re very excited to get feedback from fellow gophers. eris provides a better way to handle, trace, and log errors in Go. More info here github.com&#x2F;rotisserie&#x2F;eris and godoc.org&#x2F;github.com&#x2F;rotisserie&#x2F;eris<p>You can reach out to us on slack (gorotisserie.slack.com&#x2F;archives&#x2F;CS13EC3T6) for additional comments and feedback. Thanks!
评论 #21880534 未加载
erik_seabergover 5 years ago
Stack traces and structured output are handy, but I was hoping for a way to factor out the handler boilerplate that makes app code unreadable (like the &quot;check&quot; or &quot;try&quot; proposal for future versions).
caylusover 5 years ago
This is really cool! My company has a similar internal library but it doesn&#x27;t format wrapped errors as well as Eris.<p>One other issue I&#x27;ve struggled with is in propagating errors across goroutines. If an error is created in the child routine, `runtime.Callers` doesn&#x27;t include any stack frames from the parent. Assuming the parent wraps the error, it sounds like Eris would give you at least one line of the parent stack trace. Does it handle this specifically by including all of them?
directionlessover 5 years ago
I&#x27;d love to see a bit of the docs telling me how this improves on pkg&#x2F;errors and go 1.13. At first pass, I&#x27;m not sure?<p>It seems to have a bit of a cleaner presentation in the error stack -- Its an array, which feels nicer than a string.
chetanhsover 5 years ago
This looks pretty good. And I also get the reason behind it’s name. But for a utility package like this, it’s better if it was named errors. It makes the usage and call sites clear. Ex: eris.New() vs errors.New()
评论 #21885328 未加载
mirimirover 5 years ago
I wonder if they picked &quot;Eris&quot; based on Greg Hill&#x27;s <i>Principia Discordia</i>.
评论 #21882226 未加载
lowmagnetover 5 years ago
IDK about the error json, looks too much like a PHP dump when a descriptive error wrapper will do.
评论 #21880439 未加载