Report error from target file

Fix issue #779
Is this identical to the `EmitResolver` object used in `invokeEmitter`? If so, I think it might be a good idea to factor it out into a helper function `createEmitResolver`; that way you'll avoid some code duplication.