Return proper error message if file I/O fails

Don't just return "Unexpected error" if, for example, ejabberd's configuration file isn't found.