Exception
An exception is a runtime signal or object representing an abnormal condition that interrupts ordinary program flow and may be handled or propagated.
100 C++ Mistakes and How to Avoid Them
An exception is a C++ control-flow mechanism that transfers execution to error-handling code when an exceptional condition occurs.
- How it is used
- Uses an alternate control path to signal failures that called code cannot handle and to separate normal execution from recovery.
- How deep it goes
- Explains throwing, catching, rethrowing, type transformation, RAII cleanup, constructor validation, and signal distinctions.
- Examples
- Uses database connections, terminated employees, invalid Person values, exception references, and division-by-zero validation.
- What you can do after
- Apply exceptions to propagate unrecoverable failures, preserve resources, validate construction, and distinguish C++ exceptions from signals.
Read how 100 C++ Mistakes and How to Avoid Them explains exception →
The Quick Python Book, Fourth Edition
An exception is an abnormal runtime event represented in Python by an object that can interrupt normal execution and be handled by exception-handling constructs.
- How it is used
- Handles runtime errors and invalid computations while separating normal work from recovery code.
- How deep it goes
- Defines exception objects and propagation, then works through raising, handlers, hierarchy, custom types, and cleanup; defers detailed custom hierarchies.
- Examples
- Uses invalid list indices, disk-write failures, spreadsheet cells, and word-frequency refactoring to illustrate handling choices.
- What you can do after
- Build it from scratch: define custom exceptions and handle specific failures without scattering status checks through every function.
Read how The Quick Python Book, Fourth Edition explains exception →
Build Financial Software with Generative AI (From Scratch)
An exception is an abnormal runtime condition that interrupts normal program execution and can be handled by application code.
- How it is used
- Supports ACH upload processing by identifying, recording, and presenting business conditions that stop processing or need attention.
- How deep it goes
- Defines exceptions against errors and warnings, then works through creation, validation, tests, persistence, APIs, and UI display.
- Examples
- Uses malformed ACH headers, invalid destinations, invalid accounts and amounts, insufficient funds, trace numbers, and company-limit breaches.
- What you can do after
- Build it from scratch by creating exception files, validating and storing conditions, testing expected codes, and displaying results in a dashboard.
Read how Build Financial Software with Generative AI (From Scratch) explains exception →
Python How-To
Exception is the standard Python base class for ordinary application exceptions that should generally be catchable without intercepting system-exiting conditions.
- How it is used
- Groups ordinary Python errors under a base class suitable for custom application exceptions without including system-exiting exceptions.
- How deep it goes
- Explains the BaseException distinction and recommends custom inheritance, while illustrating raising instances and handling specific errors rather than detailing exception internals.
- Examples
- Uses invalid task urgency text, a wrong-type task title, and custom-message ValueError statements.
- What you can do after
- Build it from scratch by deriving custom exceptions from Exception, and handle expected failures with explicitly named except clauses.
Modern C, Third Edition
An exception is an abnormal execution condition that can interrupt ordinary computation and potentially terminate a program.
- How it is used
- Identifies abnormal execution conditions and motivates explicit checks, cleanup, or a transfer of control when local repair is impossible.
- How deep it goes
- Works through arithmetic cases, floating-point indicators, error cleanup, and setjmp/longjmp rather than treating every failure as one mechanism.
- Examples
- Uses division by zero, checked puts output, a number-printing function with cleanup, and a recursive parser with a jump target.
- What you can do after
- Diagnose/debug with return-value checks and floating-point indicators; practice/perform cleanup or establish a setjmp target for unrepairable conditions.
Functional Design and Architecture: Examples in Haskell
A synchronous exception is an exception raised and handled within the execution flow of the thread that encounters the abnormal condition.
- How it is used
- Distinguishes unexpected control-flow failures from expected error values at architectural boundaries.
- How deep it goes
- Explains exception flow through interpreters and free-monad scenarios, including catch-and-convert implementations.
- Examples
- Uses filesystem writes, SQLite initialization, and hardware device creation to expose exception-handling choices.
- What you can do after
- Apply it via Haskell try and interpreter boundaries to convert synchronous exceptions into explicit results.
Read how Functional Design and Architecture: Examples in Haskell explains exception →
The Art of Code
An exception is a runtime event representing an abnormal condition that interrupts ordinary program execution and can be propagated or handled.
- How it is used
- Frames exceptions as an explicit failure path in readable code and as a design choice at system boundaries.
- How deep it goes
- Explains pipeline interruption, local catching, explicit result wrapping, exception translation, stack-trace safety, and logging practices.
- Examples
- Uses Java file-reading streams with IOException, ReadResult and Optional, plus a Haskell Right/Left comparison.
- What you can do after
- Evaluate/understand when to catch, transform, log, or expose a failure without leaking raw technical details.
Rust in Action: Systems programming concepts and techniques
An exception is a synchronous or otherwise special execution event that interrupts normal program flow because of an error or exceptional condition.
- How it is used
- Distinguishes CPU-generated interruptions from device interrupts and application-level signals.
- How deep it goes
- Defines fault, trap, and abort, then implements only a minimal personality routine rather than recovery.
- Examples
- Uses page faults, integer overflow, and an empty Rust `eh_personality` function as concrete cases.
- What you can do after
- Evaluate/understand it by classifying CPU exceptions and recognizing why a minimal kernel personality function does not recover from them.
Read how Rust in Action: Systems programming concepts and techniques explains exception →
The Well-Grounded Python Developer: How the pros use Python and Flask
An exception is a runtime event representing an error or other abnormal condition that interrupts normal program execution.
- How it is used
- Signals unexpected runtime events and lets application code decide where to respond to them.
- How deep it goes
- Explains raising, stack unwinding, try/except handling, and where to catch or log exceptions, without detailing custom exception implementation.
- Examples
- Uses division by zero, invalid numeric input, and an out-of-range quiz input handled by its caller.
- What you can do after
- Apply it via Python’s raise and try/except to validate input, delegate recovery, and choose where to handle failures.
Read how The Well-Grounded Python Developer: How the pros use Python and Flask explains exception →
The Well-Grounded Rubyist, Fourth Edition
An exception is a Ruby runtime event representing an abnormal condition that interrupts ordinary program execution and can be handled by exception mechanisms.
- How it is used
- Handles runtime failures by interrupting normal control flow and transferring execution to rescue or terminating.
- How deep it goes
- Works through raising, targeted rescue, inspection, re-raising, custom classes, and ensure; defers block-based file closing.
- Examples
- Uses division by zero, number validation, invalid file lines, and file-system errors to illustrate failures and handling.
- What you can do after
- Practice/perform targeted rescue, explicit raising, exception inspection, re-raising, and cleanup with ensure.
Read how The Well-Grounded Rubyist, Fourth Edition explains exception →
Go in Practice, Second Edition
Error handling is the practice of detecting, interpreting, propagating, recovering from, or otherwise responding to program errors.
- How it is used
- Handles ordinary Go failures through explicit return values instead of try/catch exception handlers.
- How deep it goes
- Works through return conventions, nil checks, usable values on failure, and HTTP error conversion; distinguishes panics without detailing recovery mechanics.
- Examples
- Uses string concatenation with missing arguments and an HTTP request wrapper that converts unexpected responses into errors.
- What you can do after
- Practice/perform explicit error checks, return meaningful errors, and convert unexpected HTTP responses into errors callers can handle.
Read how Go in Practice, Second Edition explains exception →
Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools
An exception is an abnormal runtime condition represented by the execution environment that can interrupt or alter normal program flow.
- How it is used
- Uses exceptions to respond actively to anticipated failures in PowerShell tools, especially unattended or remote operations.
- How deep it goes
- Explains error conversion, Try/Catch flow, capture, typed handlers, and Finally, but stops short of detailed exception internals.
- Examples
- Demonstrates service lookup, computer connections, DNS hostname lookup, exception capture, typed handlers, and protocol retry.
- What you can do after
- Diagnose/debug with it by turning failures into catchable conditions, logging evidence, selecting responses, and preserving useful output.
C# Concurrency: Asynchronous and multithreaded programming
An exception is an object representing an abnormal condition that interrupts normal program execution and can be thrown or propagated.
- How it is used
- Uses exceptions to propagate failures, represent cancellation, and expose errors across synchronous and asynchronous boundaries.
- How deep it goes
- Explains call-stack propagation, compiler-generated Task handling, AggregateException, await behavior, and async void failure boundaries.
- Examples
- Demonstrates file copying, event-handler callbacks, compiler-style continuations, explicit catches, and cancellation checks.
- What you can do after
- Diagnose lost asynchronous failures, handle async void errors safely, and choose between await and direct Task inspection.
Read how C# Concurrency: Asynchronous and multithreaded programming explains exception →
Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS
An exception is a runtime condition representing an abnormal operation that can interrupt execution and be handled by an exception handler.
- How it is used
- Uses exceptions to anticipate failures, catch them, log evidence, and choose whether automation continues or stops.
- How deep it goes
- Explains terminating and nonterminating behavior, handling constructs, typed catches, and deprecated Trap, but not exception internals.
- Examples
- Demonstrates missing services, failed remote sessions, multi-computer loops, error logging, and .NET operations without ErrorAction.
- What you can do after
- Apply it via PowerShell to stop, continue, collect, log, retry, or specifically respond to command failures.
Kotlin in Action, 2E
Exception is the Java base class for conditions that a program may catch and handle, excluding serious errors represented by Error.
- How it is used
- Uses exceptions to signal invalid input, handle failures, and propagate unrecoverable coroutine errors.
- How deep it goes
- Explains throwing, catching, expression use, coroutine propagation, sibling cancellation, and cancellation-catching hazards.
- Examples
- Demonstrates percentage validation, conditional throwing, heartbeat cancellation, and timeout loops that swallow CancellationException.
- What you can do after
- Diagnose failures by tracing propagation and write handlers that avoid swallowing coroutine cancellation.
Python Workout, Second Edition
An exception is a Python runtime event representing an abnormal condition that can interrupt normal execution and be handled by exception-handling constructs.
- How it is used
- Handles invalid user input and rejects nonsensical arguments passed to reusable functions.
- How deep it goes
- Demonstrates try/except conversion, retry control flow, and custom exception classes, but does not develop broader exception hierarchies.
- Examples
- Uses integer conversion, rainfall input loops, and tax calculation with separate low-hour and high-hour exceptions.
- What you can do after
- Apply try/except to validate conversions, retry interactive input, and raise meaningful errors from reusable functions.
Read how Python Workout, Second Edition explains exception →
Learn Haskell by Example
An exception type is a Haskell type with an instance of the Exception type class whose values represent abnormal computational conditions.
- How it is used
- Handles failures at the boundary between pure code and an environment involving files, networks, or other processes.
- How deep it goes
- Defines exception values, throwing, typed catching, broad-catching risks, and Either-based recovery while deferring detailed exception categories.
- Examples
- Uses SomeFailure, error, undefined, typed catch, and safe file listing with IOException encoded in Either.
- What you can do after
- Apply it via Control.Exception to define, throw, catch, or encode typed failures for IO operations.
Build an AI Agent (From Scratch)
Error handling is the detection and management of failures arising during program execution or external requests.
- How it is used
- Keeps failed web searches and problem–model runs from stopping agent operation or batch evaluation.
- How deep it goes
- Implements catchall try/except handling and explains why production tools need error-specific responses, without implementing those responses.
- Examples
- Shows a Tavily search returning an error string and a GAIA evaluation function catching a failed run.
- What you can do after
- Build it from scratch: add a catchall exception boundary to a search tool, then identify where production failures need distinct responses.
Read how Build an AI Agent (From Scratch) explains exception →
Functional Programming in Scala, Second Edition
An exception is an abnormal runtime condition represented by a control-flow mechanism that can interrupt normal computation and be handled separately.
- How it is used
- Frames exceptions as a control-flow mechanism for runtime failure while motivating functional alternatives for recoverable errors.
- How deep it goes
- Explains throwing, catching, referential-transparency failures, context dependence, and type unsafety before deferring implementation to error ADTs.
- Examples
- Uses Scala functions that throw Exception values inside try/catch expressions and return either a failure or recovered integer.
- What you can do after
- Evaluate when exceptions obscure reasoning and model recoverable failures with typed values and composable operations.
Read how Functional Programming in Scala, Second Edition explains exception →
Tiny Python Projects: Learn coding and testing with puzzles and games
- How it is used
- Uses exceptions to expose invalid assumptions during interactive Python work and data-processing programs.
- How deep it goes
- Defines several built-in failures and demonstrates prevention, but does not develop exception-catching syntax or custom exception classes.
- Examples
- Demonstrates NameError, ValueError, and KeyError through REPL expressions, list removal, malformed CSV fields, and sampling.
- What you can do after
- Diagnose/debug with it by reading tracebacks, identifying violated assumptions, validating inputs, and testing malformed cases.
Read how Tiny Python Projects: Learn coding and testing with puzzles and games explains exception →
Akka in Action, Second Edition
An exception is an abnormal computational condition that interrupts normal program processing and can trigger failure handling.
- How it is used
- Uses exceptions to separate domain processing from actor recovery and to control failure behavior in streams.
- How deep it goes
- Explains actor restart, resume, and stop strategies and demonstrates stream logging, recovery, and data-based failure handling.
- Examples
- Demonstrates actor recovery, division-by-zero stream failure, recover with a default value, and Result-based error routing.
- What you can do after
- Diagnose/debug with it by logging stream failures, selecting actor supervision actions, or routing modeled failures to another sink.
Read how Akka in Action, Second Edition explains exception →
Idiomatic Rust
Error handling is the practice of detecting, representing, propagating, and responding to failures during program execution.
- How it is used
- Handles failures in Rust functions by representing errors and choosing whether to act on them or return them to callers.
- How deep it goes
- Explains custom error types, Result/Option propagation with ?, conversion through From, and explicit handling; treats implementing std::error::Error as optional.
- Examples
- Demonstrates reading a file’s nth line, handling I/O and invalid-line errors, and testing failures; also cautions against casual unwrap().
- What you can do after
- Apply it by defining error types, returning Result, propagating with ?, and explicitly handling cases that need action.
ASP.NET Core in Action, 3e
An exception is a runtime event representing an unexpected circumstance that interrupts normal program execution.
- How it is used
- Handles unexpected runtime failures at the middleware boundary so applications can return suitable responses instead of failing abruptly.
- How deep it goes
- Explains runtime causes, middleware propagation, and 500 responses, then contrasts exceptions with deliberate 404 and 400 results.
- Examples
- Uses NullReferenceException, an unhandled endpoint failure, a missing fruit ID, and a nonexistent route as concrete cases.
- What you can do after
- Diagnose failed requests by tracing exception propagation and distinguish unexpected 500 failures from intentional 404 or 400 responses.
Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform
An exception is a runtime object or control-flow event representing an abnormal condition that can interrupt normal program execution.
- How it is used
- Uses exceptions within a microservice error-handling strategy to reduce user and business harm.
- How deep it goes
- Explains anticipated and unexpected failures, recovery choices, try/catch, and process-level handling without detailing exception internals.
- Examples
- Uses faulty input, dependency failures, RabbitMQ, Azure Storage, and Node.js uncaught-exception handlers.
- What you can do after
- Diagnose/debug with it by selecting recovery, notification, abort, or restart behavior for anticipated and unexpected failures.
F# in Action: A Revised Edition of Get Programming with F#
An exception is a runtime event representing an abnormal condition that interrupts normal program execution.
- How it is used
- Uses exceptions for exceptional fail-fast situations within .NET error handling.
- How deep it goes
- Explains propagation, try/with handling, hidden type-signature channels, unsafe operations, and a generic wrapper, but defers detailed .NET documentation.
- Examples
- Demonstrates division by zero, array indexing, unsafe collection functions, external libraries, and generic exception-to-Result wrapping.
- What you can do after
- Apply exceptions via F# try/with, choose safer alternatives, or wrap functions into Result-returning operations.
Read how F# in Action: A Revised Edition of Get Programming with F# explains exception →
Related concepts
- ValueErrorincludes · ValueError is a built-in Python exception raised when an operation receives an argument of an appropriate type but an inappropriate value.
- type errorincludes · A type error is a violation of a program’s type rules in which a value or expression has a type incompatible with an operation or context.
- IndexErrorincludes · IndexError is a Python exception raised when a sequence or indexed object is accessed with an invalid index.
- failurecontrasts with · A failure is an unsuccessful outcome or condition in which an operation, process, or system does not achieve an expected result.
- try-catch statementimplements · A try-catch statement is a control-flow construct that executes code under exception handling and transfers control to a matching handler when an exception is raised.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.
























