Error Handling
info
Sometimes the API might fail (e.g., no internet, server down).
To avoid crashing your program, use try-catch
.
tip
async function askOpenAI(prompt) {
try {
// Do Something
} catch (error) {
// Do Something
}
}