Uniform exception handling on assemble

Catch the exception and write out some test template code.