Report declaration emit errors

Fixes #628