liveBook · Manning

Exception handler

An exception handler is a program construct that responds to an exception by processing it, determining whether execution can continue, or allowing it to propagate.

How 2 Manning books explain it

The Well-Grounded Python Developer: How the pros use Python and Flask

An exception handler is a program construct that responds to an exception and determines whether execution can continue or the exception should propagate.

How it is used
Intercepts Python exceptions at a useful application context to support retries, correction, or user guidance.
How deep it goes
Defines try/except and optional else/finally, then works through propagation and a retrying input loop without cataloging exception semantics.
Examples
Uses division prompts to demonstrate ZeroDivisionError, invalid numeric input, user messages, and retries.
What you can do after
Apply Python try/except to handle specific failures, retry operations, and guide users without silently discarding exceptions.

Read how The Well-Grounded Python Developer: How the pros use Python and Flask explains exception handler →

Spring Start Here, Second Edition

An exception handler is a method that defines the response or other processing performed for a particular exception.

How it is used
Separates REST endpoint exception processing from the controller action’s happy flow.
How deep it goes
Defines the handler and demonstrates its annotations, response, and optional exception parameter.
Examples
Uses a payment endpoint where NotEnoughMoneyException produces a 400 response containing an error message.
What you can do after
Apply Spring annotations to route a particular exception to separate response-handling logic.

Read how Spring Start Here, Second Edition explains exception handler →

Also covered in

Related concepts

Questions about exception handler

What is exception handler?

An exception handler is a program construct that responds to an exception by processing it, determining whether execution can continue, or allowing it to propagate.

Which Manning books explain exception handler?

The Well-Grounded Python Developer: How the pros use Python and Flask and Spring Start Here, Second Edition.

What is exception handler a kind of?

Exception handler is a kind of handler. A handler is a software routine or component invoked to process an event, request, message, or other input.

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.