diff --git a/core/src/main/java/io/apigee/trireme/core/modules/Filesystem.java b/core/src/main/java/io/apigee/trireme/core/modules/Filesystem.java index 92a3076d..50ee4bea 100644 --- a/core/src/main/java/io/apigee/trireme/core/modules/Filesystem.java +++ b/core/src/main/java/io/apigee/trireme/core/modules/Filesystem.java @@ -727,17 +727,18 @@ private void doMkdir(String path, int mode) { File file = translatePath(path); if (file.exists()) { - NodeOSException ne = new NodeOSException(Constants.EEXIST); - ne.setPath(path); - throw ne; + throw new NodeOSException(Constants.EEXIST, path); + } + if (file.getParentFile() != null && !file.getParentFile().exists()) { + throw new NodeOSException(Constants.ENOENT, path); } if (!file.mkdir()) { - throw new NodeOSException(Constants.EIO); + throw new NodeOSException(Constants.EIO, path); } try { setMode(file, mode); } catch (IOException ioe) { - throw new NodeOSException(Constants.EIO, ioe); + throw new NodeOSException(Constants.EIO, ioe, path); } }