Better errors for wrapFunctionString failures

cc @pushrax 
I separated by commits, so looking at the first commit is probably the easiest