Improved application error handling