cf.completefrontend

Predict the outputEasy

What does catch receive when the code throws a string or a plain object?

What does this log?
try {
  throw "Something broke";
} catch (error) {
  console.log(typeof error, error instanceof Error);
  console.log(error.message, error.stack);
}
 
try {
  throw { code: 404 };
} catch (error) {
  console.log(error.code, error.message);
}
 
try {
  throw null;
} catch (error) {
  console.log(error?.message ?? "no message");
}

The answer

Work out every line it logs, in order. Then check.

Checking your sign-in…