Improved Debug error message handling