Convert Callback-Based Code to Async/Await

Modernize legacy callback patterns into async/await using Copilot.

category:refactoring
async-await
javascript
workflow
multi-step
0

Prompt

A safe and structured way to update callback-based async code into modern async/await with error handling.

## Steps:

1. Open the callback-based function.

2. Add a comment: "Convert this callback chain to async/await."

3. Ask Copilot to generate an async/await version.

4. Review and compare side-by-side.

5. Add error handling (try/catch).

6. Update call sites to await the new async function.

7. Run tests and remove the old implementation.