Report error from target file

Fix issue #779
I agree, we should factor out the creation of emitResolver