Skip to content

missing error.path at fs.mkdir callback on last call#28015

@thisconnect

Description

@thisconnect

Expected to always have an Error with errno, code, syscall and path.

In the following 2 examples one error contains path and the other one doesn't.

  • Version: v12.3.1
  • Platform: Darwin computer.local 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64
  • Subsystem: fs
constfs=require('fs');fs.writeFileSync('./test2.txt','');// missing error.pathfs.mkdir('./test2.txt/sub/dir/dir/dir',{recursive: true},function(err){console.log('\n\nerr',err)console.log('with recursive:true error is MISSING err.path',err.path)});// error.path okfs.mkdir('./test2.txt/sub/dir/dir/dir',{recursive: false},function(err){console.log('\n\nerr',err)console.log('with recursive:false err.path is',err.path)});

I believe this was working with older node 10.x versions, possibly related to a change in #27198

Output:

err [Error: ENOTDIR: not a directory, mkdir './test2.txt/sub/dir/dir/dir']{errno: -20, code: 'ENOTDIR', syscall: 'mkdir', path: './test2.txt/sub/dir/dir/dir' } with recursive:false err.path is ./test2.txt/sub/dir/dir/dir err [Error: ENOTDIR: not a directory, mkdir]{errno: -20, code: 'ENOTDIR', syscall: 'mkdir' } with recursive:true error is MISSING err.path undefined 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions