---
title: "Exception handling over conventional error handling"
subject: "Object Oriented Programming"
chapter: 10
key: "semester_3/object_oriented_programming:exception-advantages"
source: https://www.bctengineer.com/q/semester_3/object_oriented_programming/exception-advantages
site: BCT Engineering
---

# Exception handling over conventional error handling

Object Oriented Programming · Chapter 10: Exception Handling

- Asked in: 2068 Chaitra, 3 marks
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_3/object_oriented_programming/exception-advantages
- Whole chapter: https://www.bctengineer.com/md/semester_3/object_oriented_programming/chapter-10

## Question

What are the advantages of Exception Handling over Conventional Error Handling mechanism?

## Short answer

Exception handling separates error code from normal logic, ensures errors cannot be ignored, propagates automatically, groups error types, carries data, works for constructors/operators, and uses stack unwinding to release resources.

## Answer

Conventional error handling uses return codes, global error variables (`errno`) and `if` checks after every call. Exception handling separates error handling from normal code.

#### Advantages of exception handling
1. **Separation of error code from normal logic** – the try block holds the normal flow and catch blocks hold the error handling, so the program is easier to read.
2. **Errors cannot be ignored** – an uncaught exception terminates the program, while a returned error code may be forgotten by the caller.
3. **Propagation to the right level** – an exception passes up the call chain automatically until a handler is found; with return codes every function in between must check and pass the code.
4. **Grouping of error types** – different exception types (and class hierarchies) can be caught by different handlers.
5. **Information can be carried** – an exception object can carry data about the error (message, value).
6. **Works where return values are not available** – constructors and operators have no return value to report an error.
7. **Automatic cleanup** – stack unwinding destroys local objects when an exception is thrown, which helps to release resources.

| Conventional | Exception handling |
|---|---|
| Checks after each call | One handler for a group of statements |
| Error mixed with logic | Error code kept separate |
| Can be ignored | Must be handled or program ends |

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What is a key advantage over conventional error handling?
   A. No errors occur
   B. Error handling code is separated from normal logic
   C. It needs no code
   D. It is always faster
   Answer: B. try holds normal flow and catch holds error handling. (Key point: Separation)

2. How do exceptions differ from return codes regarding ignoring errors?
   A. Return codes cannot be ignored
   B. Both can be ignored
   C. An uncaught exception terminates the program, but a return code can be forgotten
   D. Exceptions are ignored silently
   Answer: C. Uncaught exceptions end the program, so errors cannot silently pass. (Key point: Cannot ignore)

3. Why are exceptions useful for constructors?
   A. Constructors are slow
   B. Constructors cannot be called
   C. They always throw
   D. Constructors have no return value to report errors
   Answer: D. Constructors and operators have no return value, so exceptions are the way to report errors. (Key point: Constructors)

## Related in Object Oriented Programming

- [Exception handling constructs](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Aexception-handling-constructs) — Object Oriented Programming, chapter 10, asked 4×
- [Re-throwing an exception](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Aexception-rethrow) — Object Oriented Programming, chapter 10

## Related in other subjects

- [Exception handling: OO vs conventional](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Aexception-error-handling-oo-vs-conventional) — Object Oriented Analysis and Design, chapter 4
- [Exception and error testing](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Aexception-error-testing) — Software Engineering, chapter 8
- [Importance of error handling](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Aerror-handling-importance) — Object Oriented Analysis and Design, chapter 4, asked 2×
