make readDirectory module wrap errors in the convensional style