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.

Pass JSON data to Golang error using Eris package

10 pointsby sum2000about 5 years ago

2 comments

sum2000about 5 years ago
We created Eris for error handling in our Go services<p>If you&#x27;re a Go developer, there&#x27;s a very high chance you&#x27;ve seen a pkg&#x2F;errors stack trace. We&#x27;ve used it in all of our Go microservices until recently, and while it has definitely improved the debugging process, we&#x27;ve always wished some things could be better. Specifically, we wanted more readable stack traces in our JSON logs and were disappointed that trace formatting is rigid in pkg&#x2F;errors. For better or worse, we use global errors extensively and noticed that their stack traces are totally useless (containing lines like &quot;runtime.doInit&quot;, etc). It&#x27;s also clear that pkg&#x2F;errors is in maintenance mode even though Go 1.13 missed the mark on error handling in our opinion.<p>Switching over to it in our production code seemed like a risk at first, but there were enough similarities to the pkg&#x2F;errors interface that we decided to go for it. The feature that worked well for us was flexible error formatting to JSON, which takes most of the guesswork out of finding and fixing bugs. And then, later on, support for global errors was added to make their stack traces useful. We also recently started using Sentry for error monitoring and added that to Eris.<p>Overall, we&#x27;re already seeing a benefit in terms of time saved while debugging, and we&#x27;re glad we made the switch. Has anyone else found good alternatives to pkg&#x2F;errors?
handydandyrandyabout 5 years ago
Our developers are using this library in production and have to say that it solves most of our needs. If it had support for As() method it would be great!!