Improved error handling in package manager