Skip to content
This repository has been archived by the owner on Dec 6, 2018. It is now read-only.

Does not capture, handle or pass-on error states #62

Open
rvagg opened this issue Aug 18, 2014 · 0 comments
Open

Does not capture, handle or pass-on error states #62

rvagg opened this issue Aug 18, 2014 · 0 comments

Comments

@rvagg
Copy link
Contributor

rvagg commented Aug 18, 2014

LevelUP, AbstractLevelDOWN and LevelDOWN do a lot of argument sanity checking to make sure you get a sensible error in the right way if you do something wrong. Sublevel now doesn't pass everything on early enough to return the correct error types.

I have this in an the tests for level-ttl which is failing:

  t.throws(db.put.bind(db), { name: 'WriteError', message: 'put() requires key and value arguments' })
  t.throws(db.del.bind(db), { name: 'WriteError', message: 'del() requires a key argument' })

I now get an uncaughtException for this because it bubbles up through EventEmitter rather than being thrown straight from the callsite:

Error: value cannot be `null` or `undefined`
    at Object.apply (/home/rvagg/git/level-sublevel/nut.js:73:23)

Basically, sublevel is now returning faux-levelup that doesn't behave the same as levelup. I don't really have a suggestion for the best way forward except that perhaps we need ab AbstractLevelUP just for this!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant