From d5cfe17e62e1da060ca53150cd73b0bfcda3d786 Mon Sep 17 00:00:00 2001 From: Samuel Ryan Date: Thu, 14 Nov 2024 14:46:24 +0800 Subject: [PATCH] docs: Clarify when to catch --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ecf2a05..66f1e32 100644 --- a/README.md +++ b/README.md @@ -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);