Exception
An exception is a runtime signal or value representing an abnormal condition that interrupts ordinary program flow and can 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 exceptions to separate failure reporting and recovery from normal control flow.
- How deep it goes
- Explains when to throw, propagate, translate, and catch exceptions, with resource and construction examples.
- Examples
- Uses payroll connection cleanup, constructor validation, and division-by-zero checks to illustrate failures and corrections.
- What you can do after
- Apply exception handling to validate construction, preserve resources, and propagate failures to suitable handlers.
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
- Uses exceptions to handle runtime errors and abandon untenable computational branches.
- How deep it goes
- Explains raising, propagation, handler matching, class hierarchies, and custom exceptions through worked examples.
- Examples
- Uses file-writing errors, spreadsheet cell conversion, and a word-frequency refactoring exercise.
- What you can do after
- Apply exception handling in Python by raising and catching selected types and defining custom exceptions.
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 identifying and displaying ACH file-processing problems so users can address conditions beyond the happy path.
- How deep it goes
- Develops exception creation, validation, persistence, tests, and dashboard display, while leaving daily filtering as an exercise.
- Examples
- Uses invalid ACH destinations, insufficient funds, and company limits to illustrate file, entry, and business-rule exceptions.
- What you can do after
- Apply exception handling in an ACH parser using Pydantic, tests, database records, and dashboard views.
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
- Handles anticipated application errors while preserving system-exiting exceptions.
- How deep it goes
- Explains the exception hierarchy, handling clauses, raising instances, and custom inheritance with practical examples.
- Examples
- Uses invalid task urgency, division by zero, and an incorrect task title type to illustrate exceptions.
- What you can do after
- Apply it in Python to catch specific errors, raise informative exceptions, and define custom exception classes.
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
- Uses exceptional conditions to organize arithmetic safety, library error handling, and nonlocal recovery from unrecoverable failures.
- How deep it goes
- Explains error-return checks, floating-point exception flags, cleanup, and long-jump control flow with concrete code.
- Examples
- Uses a failed puts call, floating-point division, and a recursive parser with unmatched delimiters and output errors.
- What you can do after
- Diagnose and handle failures by checking C library returns, testing floating-point flags, and selecting cleanup or nonlocal control.
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
- Uses exceptions to motivate explicit error handling and conversion across architectural boundaries.
- How deep it goes
- Explains exception flow and boundary conversion through interpreter implementations, including catching within a free monadic scenario.
- Examples
- Uses filesystem writes, database initialization, and missing hardware components to illustrate failure handling.
- What you can do after
- Apply Haskell's try and a runSafely interpreter operation to catch exceptions and return 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
- Guides explicit failure handling while preserving readable control flow and protecting system boundaries.
- How deep it goes
- Works through pipeline alternatives and gives practical guidance on catch scope, translation, logging, and cause preservation.
- Examples
- Uses file-reading streams to contrast an unhandled IOException, a result wrapper, an extracted method, and a loop with local handling.
- What you can do after
- Evaluate exception-handling choices for pipeline failures and boundary crossings.
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 exceptions from interrupts and signals, then uses exception handling as a kernel and language-runtime concern.
- How deep it goes
- Defines exception categories and stack unwinding, but implements only a minimal personality routine and gives exceptions less direct attention than signals.
- Examples
- Uses page faults, integer overflow, and an empty Rust kernel personality routine to illustrate exception categories and handling.
- What you can do after
- Evaluate and understand CPU exception categories and the limitations of a minimal kernel personality routine.
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.
AI for Everyday IT
An exception is an abnormal runtime condition that interrupts or alters the normal execution of a software operation.
- How it is used
- Uses exception messages to diagnose system problems and guide configuration fixes.
- How deep it goes
- Connects exception messages to likely causes and checks, but does not explain language-level exception mechanics.
- Examples
- Uses a SharePoint configuration exception and unsafe SQL handling as practical illustrations.
- What you can do after
- Diagnose likely configuration problems by examining exception messages in system logs.
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
- Handles failed external requests so agent tools and model evaluations can return usable outcomes.
- How deep it goes
- Implements a catchall exception handler and discusses differentiated production responses without implementing them.
- Examples
- Uses a web search function returning an error string and a GAIA evaluation wrapper returning a failed result record.
- What you can do after
- Apply a catchall handler to a Python tool call and evaluate when failures need differentiated 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 →
Clean Applications with Hexagonal Architecture
An exception is a Java control-flow mechanism that represents an abnormal condition by transferring execution to exception-handling code.
- How it is used
- Carries failures from use cases, but leaves expected failure paths invisible when used as the sole channel.
- How deep it goes
- Distinguishes expected contingencies from faults and explains contract costs, without detailing exception-handling implementation.
- Examples
- Contrasts duplicate emails and missing articles with programming errors, corrupted state, and infrastructure failures.
- What you can do after
- Evaluate whether a failure is an expected use-case outcome or an exceptional fault, then choose an explicit contract accordingly.
Read how Clean Applications with Hexagonal Architecture 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 →
Spring Start Here, Second Edition
An exception signals an abnormal condition that can be thrown during execution and handled by a caller or interceptor.
- How it is used
- Handles exceptions raised by REST controller actions, either locally or through a REST controller advice class.
- How deep it goes
- Compares action-level handling with controller advice and notes coupling and duplication, without detailing implementation.
- What you can do after
- Apply exception handling in a controller action or separate it with a REST controller advice class.
Read how Spring Start Here, Second Edition explains exception →
Grokking Software Architecture
A runtime event representing an abnormal condition that interrupts normal program execution.
- How it is used
- Frames unhandled exceptions as a resilience risk when designing systems for failure.
- How deep it goes
- Names an unhandled exception but does not explain exception handling or runtime mechanics.
- Examples
- Uses an unhandled exception in reused code as the failure behind the Ariane 5 rocket loss.
- What you can do after
- Understand how an unhandled exception can turn reused code into a catastrophic system failure.
Read how Grokking Software Architecture explains exception →
Also covered in
- Elixir in Action, Third Edition
- 100 Go Mistakes and How to Avoid Them
- Build AI-Enhanced Web Apps
- Write Powerful Rust Macros
- Building Web APIs with ASP.NET Core
- Functional Programming in C#, Second Edition
- Latency
- Python Concurrency with asyncio
- Software Testing with Generative AI
- Generative AI in Action
- .NET in Action, Second Edition
- Simple Object-Oriented Design: Create clean, maintainable applications
What to know first
- functionA function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
- monitoringMonitoring is the ongoing observation and measurement of a system or process to assess its behavior or condition and detect changes, failures, or other problems.
- try-catch blockA try-catch block is a control-flow construct that executes code under exception handling and transfers control to an associated handler when a matching exception occurs.
- call stackA call stack is a runtime LIFO structure that tracks active function or method calls, including their execution contexts and return information.
Related concepts
- type errorincludes · A type error is an error arising when a value or expression is used incompatibly with its type or with the type requirements of an operation or context.
- ValueErrorincludes · ValueError is a built-in Python exception raised when an operation receives an argument of an appropriate type but an inappropriate value.
- IndexErrorincludes · IndexError is a Python exception raised when a sequence or indexed object is accessed with an invalid index.
- Eithercontrasts with · Either is a parameterized sum type whose values hold one of two alternatives, often used to represent an error or a successful result.
- failurecontrasts with · A failure is an event or condition in which an operation, component, or system does not achieve an expected result or perform its intended function.
Questions about exception
What is exception?
An exception is a runtime signal or value representing an abnormal condition that interrupts ordinary program flow and can be handled or propagated.
Which Manning books explain exception?
100 C++ Mistakes and How to Avoid Them, The Quick Python Book, Fourth Edition, Build Financial Software with Generative AI (From Scratch), Python How-To, Modern C, Third Edition, Functional Design and Architecture: Examples in Haskell, The Art of Code, Rust in Action: Systems programming concepts and techniques and 21 more.
What should I know before learning exception?
Manning books that teach exception usually introduce function, monitoring, try-catch block and call stack first.
What is the difference between exception and Either?
An exception is a runtime signal or value representing an abnormal condition that interrupts ordinary program flow and can be handled or propagated. Either is a parameterized sum type whose values hold one of two alternatives, often used to represent an error or a successful result.
What kinds of exception are there?
Kinds of exception include type error, ValueError, IndexError and IOException.
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.




























