(PUP-1100) Fix error message with create_resource and auto-loaded class

These commits fix the error message displayed by PM when a syntax error
is present on an auto-loaded file.
Done, rebased & force-pushed.