Skip to main content

Exception

Muhammad FurqanLess than 1 minute

Introduction

Programmers use various strategies to handle errors in their software systems. Programmers who work with C/C++ languages often tend to use error codes for error handling. C# and Java developers always use exception-based error-handling strategies. Meanwhile, some programmers use exceptions only for critical error-handling flows.

Almost all modern programming languages support exceptions with traditional try-catch-like syntaxes. Using exceptions is indeed okay, but exceptions make some unavoidable problems. Exceptions are for exceptional cases, but most programmers even try to avoid if-else validations with exceptions. Also, exceptions complicate the flow of the program because try-catch blocks create another logical flow to handle the error.