nodejs icon indicating copy to clipboard operation
nodejs copied to clipboard

getContactByEmail throws exception if no contact found

Open nicholas-parker opened this issue 4 years ago • 0 comments

If no contact is found the response body is an empty string. The code attempts to parse this as JSON and throws an exception. This implies that the code has failed but an empty response is a valid response as there may well be no contact in the database with a specific email address.

Proposal is to check the body and if the body is an empty string return undefined.

nicholas-parker avatar May 21 '21 08:05 nicholas-parker