Historically, Finch's error handling machinery was built on a very simple yet silly idea that an Endpoint
may return a failed Future
(i.e., Future.exception
). While that doesn't really promote a purely functional approach to error handling (i.e., treat errors as values), it enables quite a few handy setups, including:
- embedding 3rd-party Finagle clients (that may fail) within endpoints w/o extra boilerplate
- simple/minimal required endpoints (i.e.,
body
,param
, etc) that returnA
, notTry[A]
norEither[Error, A]
However this part of Finch's design was heavily influenced by Finagle itself (w.r.t. embedding all of its failures in Future.exception
), nothing stops us from revisiting this trade-off and possibly discussing paths forward more idiomatic error handling.