Skip to content

Instantly share code, notes, and snippets.

@mcsee
Last active October 12, 2025 15:13
Show Gist options
  • Save mcsee/cc4bb614c78c7da080657ca91dff7cb4 to your computer and use it in GitHub Desktop.
Save mcsee/cc4bb614c78c7da080657ca91dff7cb4 to your computer and use it in GitHub Desktop.

Revisions

  1. mcsee revised this gist Oct 10, 2025. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions BankService.cs
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,12 @@
    public void Withdraw(int amount) {
    if (amount > Balance) {
    throw new Exception("Insufficient funds");
    // You might want to show this error to end users
    }
    if (connection == null) {
    throw new Exception("Database not available");
    // Internal error, log and notify operators.
    // Fail with a more generic error
    }
    Balance -= amount;
    }
  2. mcsee created this gist Oct 10, 2025.
    9 changes: 9 additions & 0 deletions BankService.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    public void Withdraw(int amount) {
    if (amount > Balance) {
    throw new Exception("Insufficient funds");
    }
    if (connection == null) {
    throw new Exception("Database not available");
    }
    Balance -= amount;
    }