Skip to content

Instantly share code, notes, and snippets.

@gleenk
Forked from darkmavis1980/async.js
Created April 7, 2023 14:30
Show Gist options
  • Save gleenk/4c058c10c98522dae9fbb51ccd5adc26 to your computer and use it in GitHub Desktop.
Save gleenk/4c058c10c98522dae9fbb51ccd5adc26 to your computer and use it in GitHub Desktop.
const functionA = async () => {
try {
// request something that resolves in a promise
} catch (error) {
throw new Error("Function A failed");
}
}
const functionB = async () => {
try {
// request something that resolves in a promise
} catch (error) {
throw new Error("Function B failed");
}
}
// child function returns different errors
const mainWrapper = async () => {
try {
await functionA();
await functionB();
} catch (error) {
throw error;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment