Improve error reporting for assertion failures