Kaelinator / hopps

Complex data manipulation made easy
MIT License
1 stars 0 forks source link

Allow whether or not to throw errors #3

Closed Kaelinator closed 6 years ago

Kaelinator commented 6 years ago

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.

Kaelinator commented 6 years ago

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.