Improve and test the error handling of the #TABLE macro