Coding convention is we could only emit if and only if there's no else statement.
so it should be
```
if (retries > 0) {
  ...
} else {
  ...
}