Hacker News new | past | comments | ask | show | jobs | submit login

This isn't a binary choice. In Scala, you can use Throwable or Exception as your error type with Either:

  Either[Throwable, Option[Foobar]]
The type Try[T] is essentially Either[Throwable, T]

Either[Throwable, T], Try, as well as IO from Cats Effect give you the stack traces that you expect from conventional Java style, with the superior option of programming in the monadic / "railway" style. Try also interfaces nicely with Java libraries: val result: Try[Foobar] = Try(javaFunction).




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: