Kaelinator / hopps

Complex data manipulation made easy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow whether or not to throw errors

Kaelinator opened this issue · comments

Instead of simply returning an undefined value, the user should be able to specify whether or not an error is thrown when something goes wrong.

Something like:
burrow.quietly.get( ... ) should not throw errors, but return undefined,
while:
burrow.loudly.get( ... ) should throw a descriptive error.

Semantics are up for debate.

Perhaps it should assume being quiet by default, and if .thump is present, then the errors with be thrown.

For instance:
burrow.thump.get('a.b', {}) will throw something along the lines of Parent property 'a' does not exist

This way, the user can easily set all to thump within the require, or use it in specific cases.