
Wrap risky code in a try block. If an error is thrown, execution jumps to the catch block — the program does not crash. The catch block receives an error object with a message property. Add a finally block to run cleanup code regardless of success or failure. Always handle errors in async functions and API calls.
Reference:
TaskLoco™ — The Sticky Note GOAT