rework to encode error-like responses as scala.util.Failure rather then custom type