[TASK] Improved error handling