Improve error handling and create functional tests

Fixes #13
Support throwing error on missing item data

Fixes #15
Set cached resolved data only if item is found

Fixes #14
Don't use cached resolved non-leaf nodes, it may be incomplete

Fixes #16