LOGBOOK

HELP

Quiz Entry - updated: 2026.07.30

How do you manually throw an exception in JavaScript?

Use the throw statement followed by an error object or value to raise an exception manually.

if (!response.ok) {
  throw new Error('Request failed: ' + response.status);
}

Thrown exceptions propagate up until caught by a try/catch block. Best practice is to throw Error objects which include stack traces.

From Quiz: WEBT / Backend Integration | Updated: Jul 30, 2026