Challenge 2 — Solution Task: Define a custom error class InsufficientFundsError extending Error, with a constructor taking (message, shortfall) and storing shortfall. Write a function withdraw(balance, amount) that throws it if amount > balance, including the shortfall (amount - balance). Catch it and log a message using error.shortfall. class InsufficientFundsError extends Error { constructor(message, shortfall) { super(message); this.name = "InsufficientFundsError"; this.shortfall = shortfall; } } function withdraw(balance, amount) { if (amount > balance) { throw new InsufficientFundsError( "Not enough funds to complete withdrawal", amount - balance ); } return balance - amount; } try { withdraw(100, 150); } catch (error) { console.log(`${error.message}. You are short by ${error.shortfall}.`); } Expected output: Not enough funds to complete withdrawal. You are short by 50. Notes: - super(message) is required before this.name/this.shortfall can be set — it's what makes InsufficientFundsError behave like a real Error (with a proper message and stack trace) rather than just an ordinary object. - shortfall is calculated once, at the point the error is thrown (amount - balance), and travels along with the error itself — no separate calculation is needed inside the catch block. - error instanceof InsufficientFundsError (not used here, but worth knowing) would let a catch block branch differently for this specific error type versus any other.