Improve error handling during viewer initialization.