"Bad file descriptor - connect(2)" = Unable to connect to DB

When developing a Rails project I occasionally get the error message:
‘Bad file descriptor - connect(2)’

The first time this happened, it took me a while to work out that the
problem was that I have forgotten to start-up my DB server.

Is there some why to get Rails to display a more helpful error message
in this (type of) situation?