Created
May 15, 2023 09:31
-
-
Save mitzen/9af967b0b9df6a29e87c5eaaf8506f1e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // remember to wrap it up in try/catch | |
| async function lookupPromise() { | |
| return new Promise((resolve, reject) => { | |
| dns.lookup("www.aWebSiteName.am", (err, address, family) => { | |
| if(err) reject(err); | |
| resolve(address); | |
| }); | |
| }); | |
| }; | |
| try { | |
| const address = await lookupPromise(); | |
| } catch(err) { | |
| console.error(err); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment