- Open your command-line application and navigate to your workspace.
- Create a new folder named 4-07- async-errors-try-catch.
- Copy or create an index.html that loads and runs a main function from main.js.
- Create an async function, addBoosters, that throws some error:
async function addBoosters() { throw new Error('Unable to add Boosters'); }
- Create an async function, performGuidanceDiagnostic, that also throws an error:
async function performGuidanceDiagnostic (rocket) { throw new Error('Unable to finish guidance diagnostic')); }
- Create an async as the main function that calls addBosters and performGuidanceDiagnostic and handles the error:
export async function main() { console.log('Before Check'); try { await addBosters(); ...