Print Errors

Would there be some good way to print compile errors to the dom?
This works, but I think there might be a better way...