enhanced error handling to always include original exception