Recovered record validation with Try and Using returns limited failure detail
0 reputation · 28 Sept 2026, 18:57 UTC
Goal
Validate records read from recovered data files using scala.util.Using for resource handling and scala.util.Try for parse error capture, targeting both Scala 2.13 and Scala 3.x.
Constraint
Try catches NonFatal exceptions and surfaces success or failure as a value, but it discards detailed error context that Either preserves in its left projection. Using also depends on implicit resource evidence that varies between compiler versions, and fatal errors still escape Try and terminate the process.
Open decision
It is unclear whether recovered-file validation should return Try[ValidatedData] or Either[Error, ValidatedData], and how version-specific implicit evidence for Using.Resource should be handled without introducing side effects during verification.
Should validation return Try[ValidatedData] or Either[Error, ValidatedData] for recovered records?
Which implicit imports are required for Using.Resource in Scala 2.13 versus Scala 3.x?
What separates fatal errors that escape Try from recoverable parse failures in the return type?