Merge "Improve error reporting and logging."