`Error: ENOENT, No such file or directory` when db doesn't already exist. #16

Open
jed opened this Issue Feb 3, 2011 · 5 comments

Comments

Projects
None yet
3 participants

jed commented Feb 3, 2011

Currently, dirty throws an error when called with a file that does not exist. It still creates the file, though, so that subsequent attempts are successful.

Example:

var Dirty = require( "dirty" )
  , path = require( "path" )
  , real = "real.db"
  , imaginary = "imaginary.db"

require( "fs" ).writeFileSync( real, "" )

process.on( "uncaughtException", function( err ) {
  console.log( "Caught exception: " + err )
});

path.exists( real, function( exists ) {
  console.log( real + " exists? " + exists )
})

path.exists( imaginary, function( exists ) {
  console.log( imaginary + " exists? " + exists )
})

Dirty( "real.db" )
Dirty( "imaginary.db" )

path.exists( real, function( exists ) {
  console.log( real + " exists? " + exists )
})

path.exists( imaginary, function( exists ) {
  console.log( imaginary + " exists? " + exists )
})

which outputs:

$ node dirty.js 
real.db exists? true
imaginary.db exists? false
Caught exception: Error: ENOENT, No such file or directory 'imaginary.db'
real.db exists? true
imaginary.db exists? true
Owner

felixge commented Feb 3, 2011

Perfect, thanks for the report. I'll work on this when I find a minute : )

jed commented Feb 4, 2011

cool, not a huge priority obviously. hope all is good in berlin!

Owner

felixge commented Feb 4, 2011

Yeah, things are well over here. You were in SF, weren't you? I'll be going to Atlanta for 2 weeks on Sunday.

Contributor

pfleidi commented May 24, 2011

I can confirm this bug.

Owner

felixge commented May 25, 2011

Haven't found the time to work on this yet, but I would merge a pull request : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment