# Empty block

Source: https://findproxyforurl.net/rules/empty-block/ · last updated 2026-10-04

Rule PAC-B010 (`empty-block`), severity low, category: Best practice and maintainability.

An if, else or catch with an empty body is usually an unfinished edit. The condition is still evaluated (possibly a DNS lookup) and the reader has to guess what was intended.

## Why it matters

`if (dnsDomainIs(host, ".partner.example")) { }` costs the evaluation and does nothing; an
empty `catch (e) { }` swallows errors silently, which in a PAC means the request continues
to whatever follows. Both are signs of a half-done change.


## How to fix

Complete the branch with a return or delete it.

## Bad

```js
function FindProxyForURL(url, host) {
  if (dnsDomainIs(host, ".partner.example")) {
  }
  return "PROXY proxy.corp.example:8080";
}
```

## Good

```js
function FindProxyForURL(url, host) {
  if (dnsDomainIs(host, ".partner.example")) {
    return "PROXY partner-proxy.corp.example:8080";
  }
  return "PROXY proxy.corp.example:8080";
}
```
