Discussion
Loading...

Post

Log in
  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Erik C. Thauvin
Erik C. Thauvin
@ethauvin@mastodon.social  ·  activity timestamp 5 hours ago

Go's Error Handling: Why Explicit Beats Exceptions (According to Google)

#exceptions #golang #java

https://www.javacodegeeks.com/2026/01/gos-error-handling-why-explicit-beats-exceptions-according-to-google.html

Java Code Geeks

Go's Error Handling: Why Explicit Beats Exceptions (According to Google) - Java Code Geeks

Discover why Go rejected exceptions in favor of explicit error values. Learn about the if err != nil debate, Rob Pike's defense of the design
  • Copy link
  • Flag this post
  • Block
Travis F W
Travis F W
@travisfw@fosstodon.org replied  ·  activity timestamp 3 hours ago

What no programming language seems to do is to enable any kind of post-hoc error handling. The "user" sees the error and is confused, so the runtime should include some basic mechanism for them to inspect and take action. Perhaps one could write a mechanism for Throwables to look up an error recovery service (maybe with JSPI) as a minimal prototype, although such would be useful to few.

  • Copy link
  • Flag this comment
  • Block
Travis F W
Travis F W
@travisfw@fosstodon.org replied  ·  activity timestamp 4 hours ago

I always wish articles on exceptions would address Java's two branches of the Throwable type hierarchy, Exceptions and Errors. Errors should not be caught (including AssertionErrors, @jetbrains 👀) but rather should kill the whole system, maybe the whole process. This makes Java good for encapsulating systems, because the container can handle Errors. If the module author doesn't abuse the Error subtypes 👀

  • Copy link
  • Flag this comment
  • Block

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.1 no JS en
Automatic federation enabled
Log in
  • Explore
  • About
  • Members
  • Code of Conduct