Catch and emit error in readdir