Custom exception for handling tree failure