Skip to content

Error being overridden incorrectly on FS.Rename #11804

Description

@kjpou1

While renaming a file and if one of the parent paths do not exist the error code is being overwritten to EBUSY instead of reporting the actual error:

Error no 44 Error: ENOENT Message: No such file or directory 

throw new FS.ErrnoError({{{ cDefine('EBUSY') }}});

Suggested code that returns back the original error code is the following:

        // parents must exist
        var lookup, old_dir, new_dir;
        try {
          lookup = FS.lookupPath(old_path, { parent: true });
          old_dir = lookup.node;
          lookup = FS.lookupPath(new_path, { parent: true });
          new_dir = lookup.node;
        } catch (e) {
          // do not override failing error
          if (e instanceof FS.ErrnoError)
            throw e;
          throw new FS.ErrnoError(10);
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions