Advanced error handling