Retry Or Not

How to dynamically determine if a Cypress test should be retried or not based on the error.