Errors and exceptions explained: why error handling is design

TL;DR

Difficulty: Beginner

Software goes wrong all the time. What matters is what it does next, and that is decided before the code is written.

  • A fault causes an error, and an error becomes a failure only if nothing handles it.
  • Expected errors (a declined card) get a calm message to the customer. Unexpected ones (a bug) get a safe stop and a developer's attention.
  • Fail fast on bad configuration, fail safe when money is uncertain, degrade gracefully when an extra breaks.
  • Never swallow an error: in one study, 92% of catastrophic failures came from handling errors badly.
  • Retry only what is temporary, with an idempotency key. List every failure and its response in a table first.

A bank declines a card, a server stops answering, a small bug wakes up on a busy Saturday. None of that is unusual. What decides whether a business loses money is what the software does next, and that is a design decision. Here is error handling from zero, with one invented tea shop, two famous incidents and a table any owner can fill in.

What actually happens when software goes wrong

Every piece of software goes wrong sometimes. A bank declines a card. A supplier's server stops answering. A developer makes a small mistake on a Tuesday that nobody notices until a Saturday in December.

That is not the real question. The real question is what the software does next. Does it tell the customer something useful, or show a blank page? Does it try again, or charge the card twice? Does a person find out within minutes, or does the problem sit in a log file until the accountant asks why the numbers do not add up?

That "what next" is error handling. It is easy to treat it as a chore sprinkled on at the end. This article argues the opposite: error handling is design. It is a set of business decisions about what should happen when things go wrong, made on purpose, before the code is written, and you can make them without writing a line of code yourself.

I will build the idea from zero with one invented business. Fernhill Tea is a small online tea shop in Bristol (fernhilltea.example). It sells loose tea and monthly subscriptions, takes card payments through a payment provider, offers discount codes, tracks its stock and sends order emails. Its developer is Priya. By the end, Priya will have listed every way the payment step can go wrong and decided what the shop does in each case.

This is chapter five of a series on testing, and it stands on its own. The next two chapters turn these decisions into real Rails and JavaScript code and into tests for the unhappy path.

Fault, error, failure: three words for three moments

In everyday speech "bug", "error", "fault" and "failure" all mean "something went wrong". Engineers who study reliable systems keep them apart, because each names a different moment in the same story. The standard taxonomy by Avizienis, Laprie, Randell and Landwehr defines them as follows1.

  • A failure happens when the service a system delivers deviates from the correct service. It is what the customer actually experiences: a wrong total, a crash, a missing email.
  • An error is the part of the system's internal state that may lead to a failure. A wrong number sitting in memory is an error, even if nobody has seen it yet.
  • A fault is the cause of an error: a mistaken line of code, a misconfigured server, a cut network cable.

A fault can also be dormant, sitting in the code doing nothing until the right input activates it1. That is why a mistake can be harmless for months and expensive on one particular afternoon.

The chain runs fault, error, failure. Error handling lives in the gap between the second and the third: the software notices its state has gone wrong and stops that from becoming something the customer feels.

Example: the discount code that turns into a negative order

Fernhill Tea's code WELCOME10 takes £10 off a first order.

  1. The fault. Priya's discount rule subtracts the discount from the basket total and never checks whether the result can drop below zero. Every basket so far was worth more than £10, so the fault stays dormant.
  2. Activation. A customer puts a single 50g sample of Darjeeling, priced £6.00, in the basket and enters WELCOME10.
  3. The error. The code stores an order total of minus £4.00. Nothing visible has happened. The wrong state exists only inside the application.
  4. Two endings. If nothing checks the total, the payment step sends minus £4.00 to the payment provider, the provider rejects it, and the customer sees a confusing message and leaves: a failure. If a check sits in between ("an order total can never be below zero"), the error is caught, the discount is capped at the basket value, and the customer gets the sample for £0.00. No failure.

The fault was the same in both endings. Only the handling differed.

Tap or click to open full screen and move around

Expected errors and unexpected errors

The most useful question about anything that goes wrong: is it part of normal business, or a sign that something is broken?

Expected errors are outcomes you can describe in advance. A card is declined, a postcode does not exist, a tea sells out while it sits in a basket. Nothing is broken. Stripe, a payment provider, says this about declines in its own documentation: the error "can occur when your integration is working correctly"2. An expected error deserves a planned, calm response, usually a clear message to the customer.

Unexpected errors are signs that the system itself is wrong: a bug, a full disk, a missing configuration value. Nobody can fix these in the moment. The software should stop safely and tell a developer.

Programming languages draw the same line. The official Rust book divides errors into recoverable ones, such as a file that is not found, and unrecoverable ones, which "are always symptoms of bugs"3. Joe Armstrong, in his doctoral thesis on the Erlang language, put it in two sentences: exceptions occur when the runtime system does not know what to do, and errors occur when the programmer does not know what to do4. If the programmer foresaw the situation and knows what to do, it is not really an error. It is just another path through the code.

Example: sorting the checkout's problems into two piles

Priya sits down with the shop's owner, lists what can go wrong in the checkout, and sorts it.

What happensExpected or unexpectedWhy
The bank declines the cardExpectedBanks decline cards every day
The customer types a discount code that does not existExpectedPeople mistype
A tea sells out between basket and paymentExpectedStock is limited
The payment provider does not answer within ten secondsUnexpected, but foreseeableNetworks fail now and then, and nobody knows yet whether the payment happened
The order total is below zeroUnexpectedOnly a bug can cause it
The provider's secret key is missing on the serverUnexpectedA configuration mistake no customer can fix

The middle row matters. Some problems are neither bugs nor normal business. They are the outside world misbehaving, and they need their own careful answer. They come back several times below.

Exceptions: how code shouts that something went wrong

Ruby, JavaScript and most modern languages give you a built in way to signal a problem: the exception. It works in three steps.

  1. Raise (Ruby) or throw (JavaScript). Code that hits a problem it cannot sort out creates an exception object describing it. Normal execution stops at that line.
  2. Propagate. The exception travels back up the chain of methods that called each other, the call stack, one level at a time. A level that does nothing lets it pass through.
  3. Rescue (Ruby) or catch (JavaScript). Code that knows what to do with this kind of problem catches it. If nothing does, Ruby prints a message and stops5.

Two details from Ruby's documentation matter later: a rescue that names a class catches only that class and its subclasses, and a bare rescue with no class catches every StandardError5.

Example: following one exception up through the tea shop

Here is a simplified Fernhill Tea checkout in Ruby on Rails: a controller receives the click, a service object places the order, a stock method reserves the tea.

class OutOfStockError < StandardError; end

class Stock
  def self.reserve!(tea, grams)
    if tea.stock_grams < grams
      raise OutOfStockError, "#{tea.name}: #{grams}g wanted, #{tea.stock_grams}g left"
    end
    tea.update!(stock_grams: tea.stock_grams - grams)
  end
end

class PlaceOrder
  def call(basket)
    Order.transaction do
      basket.lines.each { |line| Stock.reserve!(line.tea, line.grams) }
      Order.create!(basket: basket, status: "pending")
    end
  end
end

class CheckoutsController < ApplicationController
  def create
    order = PlaceOrder.new.call(current_basket)
    redirect_to new_payment_path(order)
  rescue OutOfStockError
    flash.now[:alert] = "One of your teas has just sold out. Please check your basket."
    render :new, status: :unprocessable_entity
  end
end

Line by line:

  • OutOfStockError < StandardError defines a new kind of exception whose name says exactly what happened.
  • In Stock.reserve!, if there is less tea than wanted, raise creates the exception with a message for the developer (tea name and amounts). The stock is not reduced.
  • PlaceOrder#call reserves stock for every basket line and rescues nothing, so the exception passes straight through.
  • It all sits inside Order.transaction. A database transaction groups changes so that all happen or none do. An exception inside the block triggers a rollback and is then raised again6. If the third of three teas is sold out, the stock reserved for the first two is put back automatically.
  • CheckoutsController#create has rescue OutOfStockError, the first code that knows what to do: show the checkout again with a plain message and status 422, which tells the browser the request could not be processed as sent.
  • Any other exception, say a database outage, is not caught here, because the rescue names only OutOfStockError. That is deliberate. Treating an outage as a stock problem would hide it.

One exception, raised three levels down, travels to the one place that can handle it, and undoes the half finished work on the way.

JavaScript works the same way with throw, try and catch, with one trap for beginners. The browser's fetch function does not throw when the server answers with an error status such as 404 or 504. According to MDN it only rejects when the request itself fails, for example on a network error, so your code has to check response.ok7.

async function loadSubscription(id) {
  const response = await fetch(`/api/subscriptions/${id}`)
  if (!response.ok) {
    throw new Error(`Subscription ${id} could not be loaded: HTTP ${response.status}`)
  }
  return response.json()
}

await fetch(...) waits for the answer. The if turns an error status into a real exception that names the subscription and the status, so no caller can mistake a failed load for an empty subscription.

Return values and result objects: the quieter alternative

The other way to report a problem is to return it as an ordinary value and make the caller look at it. Rust has no exceptions at all: it uses a Result type for recoverable errors and panic! to stop on unrecoverable ones3. Rails mixes both styles: save returns false when a record is invalid, while save! raises ActiveRecord::RecordInvalid8.

A good rule of thumb: return a value for everyday outcomes the caller must always consider, and raise an exception for situations that should not happen in normal operation.

Example: checking a discount code with a result object

Priya rewrites the discount check so it returns a small result object. Ruby's Data class builds one in a line.

DiscountCheck = Data.define(:ok, :amount, :reason)

def check_discount(code, basket_total)
  discount = Discount.find_by(code: code.strip.upcase)
  return DiscountCheck.new(ok: false, amount: 0, reason: :unknown_code) if discount.nil?
  return DiscountCheck.new(ok: false, amount: 0, reason: :expired) if discount.expires_on < Date.current

  amount = [discount.amount, basket_total].min
  DiscountCheck.new(ok: true, amount: amount, reason: nil)
end
  • Data.define creates a small read only object: did it work, how much comes off, and if not, why not.
  • The lookup strips spaces and upper cases the code, so " welcome10 " still matches.
  • An unknown or expired code returns ok: false with a reason. These are expected outcomes, so they come back as values, and the checkout turns each reason into its own friendly sentence.
  • [discount.amount, basket_total].min takes the smaller number. A £10 code on a £6 basket gives £6 off, never more. This is the check missing from the first example. The negative order is now impossible.

No exception anywhere, because nothing here is broken.

Fail fast, fail safe, degrade gracefully

Once something has gone wrong, there are three broad strategies.

Fail fast. Stop immediately and visibly rather than carry on with bad data. Jim Shore described it in IEEE Software in 2004: a system that fails fast "fails immediately and visibly", while one that works around problems "fails slowly" and breaks in strange ways later9. It sounds fragile, but bugs become easy to find, so fewer reach customers.

Fail safe. When you must stop, stop in the state that does the least harm. A payment you are unsure about is never marked paid. Stock you are unsure about is never sold twice.

Degrade gracefully. When something nice to have breaks, switch it off and keep the essentials running.

Which one fits depends on what is at stake. That is why it is a design decision.

Example: three problems at Fernhill Tea, three responses

  1. Fail fast: the missing key. After a deployment, the server lacks the secret key for the payment provider. Priya's application checks for it at start up and refuses to boot. With a deployment tool that only switches traffic to a version once it has started properly, the old version keeps serving customers and nobody outside notices. The alternative, a shop that looks fine until the first customer pays, is far worse.
  2. Fail safe: the payment nobody is sure about. The connection to the provider drops before an answer comes back. Did the money move? Stripe's documentation says to treat the result as indeterminate, assume neither success nor failure, and find out from the provider2. So the order is stored as "payment pending": not shipped, not charged again, checked before anything else happens.
  3. Degrade gracefully: the recommendations. The "you might also like" box comes from a separate service that times out one evening. The page leaves the box out and shows the tea, the price and the basket button as usual.

Let it crash, and let something else clean up

A fourth strategy sounds reckless and is anything but. It comes from Erlang, which grew out of work at Ericsson on telecom software that has to keep running. Armstrong's thesis states it plainly: let some other process fix the error, and in the code that hits the problem, "let it crash"4. Small, isolated workers each do one job. When one meets a situation it cannot handle, it stops, and a supervisor whose only job is watching workers starts a fresh one in a clean state.

The key words are small and isolated. A crash is safe when it takes down one small piece of work, leaves nothing half finished, and something reliable restarts it.

Example: the order email that crashes

After a payment, Fernhill Tea sends a confirmation email. Priya can build that two ways.

  • Fragile: send the email inside the payment step. If the email service is down, the checkout raises an exception and the customer sees an error page although their card was charged.
  • Sturdy: finish the payment, save the order as paid, then hand the email to a background job that runs separately from the customer's request. If the email service is down, the job crashes, the job system runs it again later, and only after the last attempt does it ask a person to look. The customer already saw the "Thank you" page, and the email arrives a few minutes late.

Same failure. In the second design the crash is small, isolated and restarted. Setting up those retries in Rails is part of the next chapter.

Never swallow an error silently

The most damaging habit in error handling is catching an error and doing nothing with it. Developers call it swallowing an error. The code carries on as if nothing happened, and the evidence disappears.

This is measured, not a matter of taste. A team at the University of Toronto studied 198 real failures in five widely used distributed systems, including Cassandra, HDFS and Redis, and looked closely at the 48 catastrophic ones, which affected all or most users10. 92% of those were caused by incorrect handling of non fatal errors that the software had explicitly signalled. The system noticed the problem and then handled it badly. 35% came from three trivial patterns: a handler that was empty or only wrote a log line, a handler that aborted everything on an overly general exception, and a handler with "TODO" or "FIXME" in it10. The authors call error handling code the last line of defence and found that simple testing of it would have caught most of these.

Breakdown of 48 catastrophic failures studied by Yuan and others, 2014. Error ignored by the handler: 25%. Abort on an overly general catch: 8%. TODO left in the handler: 2%. Other handling mistakes easy to catch: 23%. Complex handling bugs: 34%. Not caused by error handling: 8%. Tap or click to open full screen and move around

The first three bars add up to the 35% of trivial mistakes. With the fourth they reach 58%, the share the authors say simple testing of error handling code would have found10.

Example: the silent rescue that ships unpaid orders

Here is a payment method with all three trivial patterns at once.

def pay(order)
  begin
    PaymentGateway.charge(order.total_pence, order.payment_token)
  rescue => e
    # TODO: handle this properly
  end
  order.update!(status: "paid")
  OrderMailer.confirmation(order).deliver_later
end

When the payment provider times out:

  1. PaymentGateway.charge raises a timeout exception.
  2. The bare rescue => e catches it, because a bare rescue catches every StandardError5. The handler is empty apart from a comment.
  3. Execution continues as if the payment had worked. The order is marked "paid".
  4. A confirmation email goes out and the tea is packed.
  5. No money arrived, and nobody knows: nothing was logged, nobody was alerted, and the only trace is a TODO.

Priya's corrected version does less, and that is why it is right.

def pay(order)
  PaymentGateway.charge(order.total_pence, order.payment_token)
  order.update!(status: "paid")
  OrderMailer.confirmation(order).deliver_later
  :paid
rescue PaymentGateway::CardDeclined
  order.update!(status: "declined")
  :declined
end
  • It rescues exactly one expected outcome, PaymentGateway::CardDeclined. The order is marked "declined" and the method returns :declined, so the checkout can ask for another card.
  • Every other exception, a timeout, a bug, a wrong key, travels up. The order stays "pending" (fail safe), and the shop's error monitoring records it for Priya.

PaymentGateway is Priya's own thin wrapper around the provider, so the rest of the shop deals with a few clear error names instead of the provider's full list.

The error nobody read: an alert must reach a person

Handling an error inside the code is half the job. The other half is making sure a person finds out when it matters.

The clearest lesson is the US Securities and Exchange Commission's 2013 order against Knight Capital Americas11. On 1 August 2012, after a technician failed to copy new code to one of eight servers, old unused code on that server was triggered by a reused setting. In about 45 minutes it produced more than 4 million executions in 154 stocks for more than 397 million shares, and Knight lost more than $460 million11.

What belongs in this article happened before the market opened. From about 8.01am New York time, an internal system sent automated emails naming the affected system and an error called "Power Peg disabled", 97 of them before the 9.30am open. Knight had not designed these messages as alerts, and staff generally did not review them. The SEC calls them "a potential opportunity to identify and fix the coding issue prior to the market open"11.

The error was detected and reported 97 times. It was simply sent where nobody looked.

Example: Priya's alert list

Priya decides on paper where each signal goes. An alert must be rare enough that someone always reads it and specific enough that they know what to do.

SignalWhere it goesWho acts
A payment left "pending" for more than 15 minutesPriya's phone, straight awayPriya checks it with the provider
More than three server errors on checkout pages in five minutesPriya's phone, straight awayPriya
An email job that failed its last retryDaily summary emailPriya, next morning
Declined cardsWeekly countThe owner, if the rate jumps
Everything elseSearchable logsNobody, until there is a question

A declined card never wakes anyone. The customer already got a message, and an alert would only train Priya to ignore alerts, which is how 97 warnings go unread.

One error, two messages: for the customer and for the developer

Every error has two audiences who need opposite things. The customer needs a short, kind sentence: what happened and what to do now. The developer needs every technical detail. The Open Worldwide Application Security Project (OWASP) warns that detailed error output shown to users helps attackers learn how a system is built, and recommends a generic response to the user with the details logged on the server12. The GOV.UK Design System adds that an error message should say what has happened and how to fix it, and avoid technical jargon, blaming words such as "forbidden", vague ones such as "invalid", and jokey ones such as "oops"13.

And the developer's half should hold what you need to understand the problem, and nothing personal you do not need. The next chapter shows how to log with context and without personal data.

Example: a declined card, written twice

A customer pays for 250g of Assam and a subscription, and the bank declines the card.

The customer sees:

Your bank declined this card. Try a different card, or contact your bank and then try again. Your basket is saved.

It says who declined (the bank, not the shop), what to do, and what is not lost. No codes, no "invalid".

Priya's log records:

{"event":"payment.declined","order_id":"FT-20931","provider_request_id":"req_8Hc2","decline_code":"insufficient_funds","amount_pence":2450,"at":"2026-11-14T19:42:07Z"}

Every field helps trace this exact attempt with the provider. None identifies the customer. The decline code stays in the log and never appears on screen, because nobody looking over a shoulder needs to learn that an account is short of funds.

What poor handling cost Ariane 5

The most famous lesson in error handling has nothing to do with shops. On 4 June 1996 the first Ariane 5 rocket veered off course less than 40 seconds into its flight, broke up and exploded14. The inquiry board, chaired by Professor J. L. Lions, found the following14.

  1. In the inertial reference system, which tells the rocket where it is pointing, software converted a 64 bit floating point number into a 16 bit signed integer. The number was too large, and the conversion raised an exception called an Operand Error.
  2. That conversion was not protected, although comparable conversions in the same place in the code were.
  3. The failing code did an alignment calculation that only means something before lift off. It kept running for about 40 seconds of flight, a timing inherited from Ariane 4.
  4. The backup unit, running identical software, had already failed 72 milliseconds earlier for the same reason.
  5. The specification said that on any exception the failure should be reported, the context stored and the processor shut down. The report: "It was the decision to cease the processor operation which finally proved fatal."
  6. That rule assumed an exception meant a random hardware fault, where switching to the backup makes sense. This was a design error, identical in both units. The board concluded the exception was detected but inappropriately handled, because software had been considered correct until shown to be at fault, and it favoured the opposite view.

The overflow was the fault. Shutting down working guidance over a calculation that no longer mattered was a handling decision, made years earlier in a specification.

Example: what a rocket teaches a tea shop

Fernhill Tea runs on two application servers, so that if one machine dies, the other keeps the shop open. That protects against hardware faults. It does nothing against a bug: both servers run the same code, so the same input crashes both, just like the two inertial units.

So Priya's handlers must tell "the machine is broken" (move to the other one) from "the code is wrong" (stop that one request, keep everything else running, alert a developer). And retrying a bug, on the second server or ten times on the first, only repeats the mistake. Which brings us to retries.

When a retry helps and when it only repeats the mistake

Trying again is the most tempting response to any error. It is right for one kind and wrong for the others, and a little probability shows why.

If a problem is temporary and random, such as a brief network hiccup, and each attempt fails independently of the last, the chance that every attempt fails is:

Pall fail=pkP_{\text{all fail}} = p^{k}

where pp is the probability that a single attempt fails, kk is the total number of attempts, and Pall failP_{\text{all fail}} is the probability that all kk attempts fail. It only holds when the attempts are independent, meaning one failure tells you nothing about the next. Foundations: probability explains independent events from scratch.

A declined card stays declined and a bug fails the same way every time. For those p=1p = 1, and 1k=11^{k} = 1 however many attempts you make.

Example: Fernhill Tea's provider timeout, by the numbers

Assume, as an invented figure for this example, that 2 in every 100 calls to the payment provider time out, so p=0.02p = 0.02, independently. With three attempts in total:

Pall fail=0.023=0.000008P_{\text{all fail}} = 0.02^{3} = 0.000008

That is 0.000008=0.0008%0.000008 = 0.0008\%, about 8 in every million payments. Three attempts turn a problem that hits two customers in a hundred into one that almost never reaches anyone. Retrying a timeout is worth it.

For a declined card, three attempts mean three declines, and Stripe's documentation on declines even refers to network costs and "excessive retry penalties"15. The timeout case hides a trap too. If the first attempt reached the provider and only the answer was lost, a naive retry charges the customer twice. The protection is an idempotency key, a unique label sent with the request so the provider performs a repeat only once. Stripe advises retrying connection errors with the same key and the same parameters2, and the next chapter builds it in code.

Priya's rule: retry what is temporary, with the same idempotency key and a growing wait between attempts. Never retry a decision such as a decline, and never retry a bug.

Error handling is design: decide before you code

Everything so far comes together in one exercise. For every step that matters, list the ways it can go wrong and decide in advance which response each gets:

  • Retry: the problem is temporary and trying again is safe.
  • Tell the customer: an expected outcome the customer can act on.
  • Alert the developer: a person needs to look.
  • Stop: carrying on would make things worse, so stop in a safe state.

Many failures get two, such as "stop and alert". The point is that nobody decides at two in the morning while the shop loses orders. It is decided on a calm afternoon, written down, and then turned into tests and code.

A business owner can do this without writing code. Should a customer with a pending payment read "We are checking your payment" or "Please try again later"? Should the owner hear about a spike in declines? Those are decisions about customers and money.

In my own work this is where test first development starts: each row becomes a scenario and a failing test before any handling code exists, and the payment step sits in the highest risk tier, where I decide and AI only advises. Writing those tests is the subject of testing the unhappy path, and keeping the rule when an assistant writes much of the code is covered in test driven development with AI.

Example: every way Fernhill Tea's payment step can go wrong

Priya and the owner fill in the table together in under an hour.

What goes wrongExpected?ResponseWhat the customer sees
The bank declines the cardYesTell the customer"Your bank declined this card. Try a different card, or contact your bank."
Expired card or wrong security codeYesTell the customerA message at the right field: "Enter the security code from the back of your card"
The provider blocks the payment as high riskYesTell the customer"This payment could not be completed. Try a different payment method."
The connection times outNo, but foreseeableRetry twice with the same idempotency key, then stop as "pending" and alert if still unknown"We are confirming your payment. You will get an email within a few minutes."
The provider reports an error on its sideNoStop as "pending", confirm with the provider before shipping, alertAs above
The provider says too many requestsNo, but foreseeableRetry after a wait that grows each timeNothing, unless every retry fails
The provider rejects the secret keyNoStop and alert straight away, checked at start up so a deploy fails fast"Payments are not available right now. Your basket is saved."
The order total is zero or belowNo (a bug)Stop before any charge, alert"Something went wrong with your order total. Nothing has been charged."
The confirmation email fails after paymentNo, but foreseeableDegrade: the order stands, the email job retries, alert after the last retryThe normal "Thank you" page

Three things stand out. Every row where money might have moved without the shop knowing ends in "pending", never "paid" or "failed". Only two rows wake Priya straight away. And no row says "ignore it".

The flow below is the decision Priya's code makes each time an error happens in the checkout.

Tap or click to open full screen and move around

The short version

Every piece of software has faults. What separates a shop that loses money from one that shrugs it off is what happens between an error and a failure, and people decide that before the code is written.

A fault causes an error, and an error becomes a failure only if nothing handles it. Expected problems deserve a calm message, unexpected ones a safe stop and a person's attention. Use exceptions for the exceptional and return values for everyday outcomes. Fail fast on bad configuration, fail safe whenever money is uncertain, degrade gracefully when an extra breaks, and let small isolated work crash and restart. Never swallow an error, send alerts only where someone reads them, and write two messages, one for the customer and one for the developer.

Then write it all down, step by step, before anyone writes code. That table is the design. The code and the tests make it true.

If you want to know what your shop or product does when a payment fails, a server times out or a bug wakes up, book the free workshop: we list every failure on your critical steps together and decide what should happen, and the first two weeks of work are on me.

Sources

  1. 1.

    Algirdas Avizienis, Jean Claude Laprie, Brian Randell and Carl Landwehr, Basic concepts and taxonomy of dependable and secure computing, IEEE Transactions on Dependable and Secure Computing, vol. 1, no. 1, 2004 (DOI 10.1109/TDSC.2004.2); author version in the University of Maryland repository, https://drum.lib.umd.edu/handle/1903/6459

  2. 2.

    Stripe, Error handling, Stripe documentation (Ruby version), accessed November 2026, https://docs.stripe.com/error-handling

  3. 3.

    Steve Klabnik, Carol Nichols and Chris Krycho, The Rust Programming Language, chapter 9: Error handling, rust-lang.org, accessed November 2026, https://doc.rust-lang.org/book/ch09-00-error-handling.html

  4. 4.

    Joe Armstrong, Making reliable distributed systems in the presence of software errors, doctoral dissertation, Royal Institute of Technology (KTH), Stockholm, 2003, section 4.4 "Let it crash", https://erlang.org/download/armstrong_thesis_2003.pdf

  5. 5.

    Ruby documentation, Exceptions, Ruby 3.4, ruby-lang.org, https://docs.ruby-lang.org/en/3.4/exceptions_md.html

  6. 6.

    Ruby on Rails API documentation, ActiveRecord::Transactions::ClassMethods, rubyonrails.org, https://api.rubyonrails.org/classes/ActiveRecord/Transactions/ClassMethods.html

  7. 7.

    MDN Web Docs, Window: fetch() method, Mozilla, accessed November 2026, https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch

  8. 8.

    Ruby on Rails Guides, Active Record Validations, rubyonrails.org, https://guides.rubyonrails.org/active_record_validations.html

  9. 9.

    Jim Shore, Fail fast, IEEE Software, vol. 21, no. 5, September/October 2004, pages 21 to 25, https://martinfowler.com/ieeeSoftware/failFast.pdf

  10. 10.

    Ding Yuan, Yu Luo, Xin Zhuang, Guilherme Renna Rodrigues, Xu Zhao, Yongle Zhang, Pranay U. Jain and Michael Stumm, Simple testing can prevent most critical failures: an analysis of production failures in distributed data intensive systems, 11th USENIX Symposium on Operating Systems Design and Implementation (OSDI 14), 2014, https://www.usenix.org/conference/osdi14/technical-sessions/presentation/yuan

  11. 11.

    U.S. Securities and Exchange Commission, In the Matter of Knight Capital Americas LLC, Administrative Proceeding File No. 3-15570, Release No. 34-70694, 16 October 2013, paragraphs 1 and 15 to 19, https://www.sec.gov/litigation/admin/2013/34-70694.pdf

  12. 12.

    OWASP Cheat Sheet Series, Error Handling Cheat Sheet, OWASP Foundation, accessed November 2026, https://cheatsheetseries.owasp.org/cheatsheets/Error_Handling_Cheat_Sheet.html

  13. 13.

    GOV.UK Design System, Error message, Government Digital Service, accessed November 2026, https://design-system.service.gov.uk/components/error-message/

  14. 14.

    J. L. Lions (chair) and the Inquiry Board, Ariane 5 Flight 501 Failure: Report by the Inquiry Board, Paris, 19 July 1996, European Space Agency, https://esamultimedia.esa.int/docs/esa-x-1819eng.pdf

  15. 15.

    Stripe, Declines, Stripe documentation, accessed November 2026, https://docs.stripe.com/declines