json: error propagation mechanism

try to have it so that errors raised during processing
propagate outwards into the json output
Maybe a bit more error handling
Stub work on recursive directory traversal

Idea here is to generate a JSON output for every input file
we find by recursively walking an input dir.

But we may need to modify things on the DATR side so that we
can directly access the query result instead of having the
DATR stuff print them out.