Introduce CustomError type for gracefully error handling