Created
March 23, 2023 17:45
-
-
Save csuwildcat/12d36a2c6e8f18f56685dc3928aab484 to your computer and use it in GitHub Desktop.
This file contains 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
let result | |
for (let endpoint of endpoints) { | |
try { | |
const url = parseURL(endpoint); | |
result = await this.#transports[url?.protocol?.slice(0, -1)]?.send(url.href, request); | |
} | |
catch(e){ | |
} | |
}; | |
if (result) return result; | |
else { | |
console.error('All service endpoints were unreachable.', error); | |
return { status: { code: 503, detail: 'Service Unavailable' } }; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment