Skip to content

Instantly share code, notes, and snippets.

@darkmavis1980
Created April 7, 2023 11:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save darkmavis1980/2329462ed76aaa4129ce5750b61cfa21 to your computer and use it in GitHub Desktop.
Save darkmavis1980/2329462ed76aaa4129ce5750b61cfa21 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