'Try Catch methods are throwing promises [duplicate]

let metadata = allNFTs.map(async (e) => {
      try {
        const res = JSON.parse(e.metadata.attributes);
        return res;
      } catch (err) {
        // throw err;
        let config = {
          method: "get",
          url: `http://localhost:3000/api/fetch`,
          header: {
            "Content-Type": "application/json",
          },
        };
        const res = await axios(config);
        console.log(res.data.attributes);
        return res.data.attributes;
      }
    });
console.log(metadata);

I want use try catch method like this but all i can get bunch of promises on my console

enter image description here

When i tried if statement my next.js app throwing me that error. I want to do something if e.metadata.attributes is empty or null or undefined but my app throwing errors.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source