Really, it depends on your domain model. Why is it that you use an Either
in the first place? Generally speaking, the fact that a record for a particular ID isn't found because the record doesn't exist, is a normal result but that the record isn't found because the DB doesn't exist is not. So, it certainly makes sense to treat the two cases differently, i.e. return an Either
in the first case and throw an exception in the second.
Of course, in a distributed application or a mobile one, losing the DB connection might be normal. And when using the DB only as dumb storage and managing all relationships in your application, not finding a record that the app expects to be there is an exceptional situation. It all depends on context.