Add a doc param for handler

Error recipients should see what doc caused the problem.
Add toplevel recovery function

Most possible panics will occur in getFile, but just to be safe include
one at higher scope.
Pass around struct instead of lists and strings
wip (broken)