Skip to content

Commit

Permalink
docs: Clarify when to catch
Browse files Browse the repository at this point in the history
  • Loading branch information
shrink committed Nov 14, 2024
1 parent 0424557 commit d5cfe17
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ const ipinfo = await ipinfoWrapper.lookupIp("1.1.1.1");
#### Best practices

Each `lookup` method will throw an error when the lookup does not complete
successfully. A program that performs a lookup should catch errors and return
a default value. For example, if your program is performing a lookup to find the
country code of an IP:
successfully. A program that performs a lookup should catch errors unless it is
desirable for the error to bubble up. For example, if your program is performing
a lookup to find the country code of an IP:

```typescript
const ipinfo = await ipinfoWrapper.lookupIp("1.1.1.1").catch(error => null);
Expand Down

0 comments on commit d5cfe17

Please sign in to comment.