How to handle the navigation error in “Failed to fetch”

According to this answer on Stackoverflow, one of the reason a “Failed to fetch” can occur is because of navigation.

Browser aborted — most likely due to navigation to another page before the fetch completes

How can I handle this specific error in simple fetch query?

fetch("https://xxx.yyy/").then(e => e);

I don’t want to handle all “failed to fetch” error, only the ones that are triggered because of navigation.