Api Error Handling
Lesson for api-error-handling
Api Error Handling
Learning from AstroPlatformer
Code Runner Challenge
api-error-handling
View IPYNB Source
%%js
// CODE_RUNNER: api-error-handling
try {
const x = JSON.parse("invalid");
} catch(e) {
console.log("Caught error:", e.message);
}
try {
const s = localStorage.getItem("test");
console.log("Storage ok");
} catch(e) {
console.log("Storage error:", e);
}
Lines: 1
Characters: 0
Output
Click "Run" in code control panel to see output ...