News for hackers. Stuff that matters.
Re:Cloudflare outage on November 18, 2025 post mortem by Terr_ on Tuesday November 18, 2025 @09:46PM (#45975295)
"Checked Exceptions Are Actually Good" gang, rise up! :p

I think adoption would have played out very different if there had only been some more syntactic-sugar. For example, an easy syntax for saying: "In this method, any (checked) DeepException e that bubbles up should immediately be replaced by a new (checked) MylayerException(e) that contains the original one as a cause.

We might still get lazy programmers making systems where every damn thing goes into a generic MylayerException, but that mess would still be way easier to fix later than a hundred scattered RuntimeExceptions.

Re:Cloudflare outage on November 18, 2025 post mortem by bigstrat2003 on Tuesday November 18, 2025 @10:27PM (#45975517)
I'm with you! Checked exceptions are actually good and the hate for them is super short sighted. The exact same criticisms levied at checked exceptions apply to static typing in general, but people acknowledge the great value static types have for preventing errors at compile time. Checked exceptions have that same value, but are dunked on for some reason.
Re:Cloudflare outage on November 18, 2025 post mortem by never_inline on Tuesday November 18, 2025 @11:57PM (#45976011)
The dislike is probably because of 2 reasons.

1. in most cases they don't want to handle `InterruptedException` or `IOException` and yet need to bubble them up. In that case the code is very verbose.

2. it makes lambdas and functions incompatible. So eg: if you're passing a function to forEach, you're forced to wrap it in runtime exception.

3. Due to (1) and (2), most people become lazy and do `throws Exception` which negates most advantages of having exceptions in the first place.

In line-of-business apps (where Java is used the most), an uncaught exception is not a big deal. It will bubble up and gets handled somewhere far up the stack (eg: the server logger) without disrupting other parts of the application. This reduces the utility of having every function throw InterruptedException / IOException when those hardly ever happen.

Re:Cloudflare outage on November 18, 2025 post mortem by dehrmann on Wednesday November 19, 2025 @01:55AM (#45976600)
> 2. it makes lambdas and functions incompatible.

This is true, but the hate predated lambdas in Java.

Re:Cloudflare outage on November 18, 2025 post mortem by ErikCorry on Wednesday November 19, 2025 @04:34AM (#45977593)
You could always manually build the same thing as lambda with a class and you had the same problem.
Re:Cloudflare outage on November 18, 2025 post mortem by frumplestlatz on Wednesday November 19, 2025 @04:30AM (#45977560)
> an uncaught exception is not a big deal

In my experience, it actually is a big deal, leaving a wake of indeterminant state behind after stack unrolling. The app then fails with heisenbugs later, raising more exceptions that get ignored, compounding the problem.

People just shrug off that unreliability as an unavoidable cost of doing business.

Re:Cloudflare outage on November 18, 2025 post mortem by loglog on Wednesday November 19, 2025 @07:06AM (#45978582)
Java checked exceptions suffer from a lack of generic exception types ("throws T", where T can be e.g. "Exception", "Exception1|Exception2", or "never") This would also require union types and a bottom type. Without generics, higher order functions are very hard to use.
Re:Cloudflare outage on November 18, 2025 post mortem by Terr_ on Tuesday November 18, 2025 @11:05PM (#45975739)
Yeah, in both cases it's a layering situation, where it's the duty of your code to decide what layers of abstraction need to be be bridged, and to execute on that decision. Translating/wrapping exception-types from deeper functions is the same as translating/wrapping return-types the same places.

I think it comes down to a psychological or use-case issue: People hate thinking about errors and handling them, because it's that hard stuff that always consumes more time than we'd like to think. Not just digitally, but in physical machines too. It's also easier to put off "for later."

Re:Cloudflare outage on November 18, 2025 post mortem by lenkite on Wednesday November 19, 2025 @12:35AM (#45976226)
Checked exceptions in theory were good, but Java simply did not add facilities to handle or support them well in many APIs. Even the new API's in Java - Streams, etc do not support checked exceptions.
Re:Cloudflare outage on November 18, 2025 post mortem by Skeime on Wednesday November 19, 2025 @04:10AM (#45977407)
There is also the problem that they decided to make all references nullable, so `NullPointerException`s could appear everywhere. This "forced" them to introduce the escape hatch of `RuntimeException`, which of course was way overused immediately, normalizing it.
Re:Cloudflare outage on November 18, 2025 post mortem by twhitmore on Wednesday November 19, 2025 @05:35AM (#45977958)
Exception handling would be better than what we're seeing here.

The problem is that any non-trivial software is composition, and encapsulation means most errors aren't recoverable.

We just need easy ways to propagate exceptions out to the appropriate reliability boundary, ie. the transaction/ request/ config loading, and fail it sensibly, with an easily diagnosable message and without crashing the whole process.

C# or unchecked Java exceptions are actually fairly close to ideal for this.

The correct paradigm is "prefer throw to catch" -- requiring devs to check every ret-val just created thousands of opportunities for mistakes to be made.

By contrast, a reliable C# or Java version might have just 3 catch clauses and handle errors arising below sensibly without any developer effort.

https://literatejava.com/exceptions/ten-practices-for-perfec...