implementing error handling through synchronizing tokens