Two failures that are or-ed should return a failure that somehow combines both causes.
$ def getFromProperties = Failure("Property not set")
$ def getFromFilesystem = Failure("File doesn't exist")
$ def getFromDb = Failure("DB not configured")
$ def getSomething : Box[Something] = getFromProperties or getFromFilesystem or getFromDb
Failure("DB not configured")
Something that can give all 3 messages/exceptions if all of them failed because current behaviour swallows exceptions and return only the last one, that might be not the one that the user is interested in.
Or-ing Failure and Empty can return the one Failure or maybe some combined Failure that has both?
Just chaining might be not enough, because it's not clear how or() result can chain two Failures that have chains themselves. Maybe it would be useful to have MultiFailure class extending Failure just as there is ParamFailure? Or maybe Failure.chain should be List[Failure] not Box[Failure]?
No file chosen
You have an empty file field. Please select or remove it.
Drop the files anywhere in this page to upload them as attachments.