Errors, Bugs, and Exceptions

Posted on Updated on

Errors, Bugs, and Exceptions

In spite of what our (occasionally expanded) self images may let us know, no software engineer is great. Composing programming is a complex undertaking, and given this multifaceted nature, it is entirely regular for even the best programming to transport with various…problems. Once in a while the issue is brought about by “terrible code, (for example, flooding the limits of an exhibit). Different times, an issue is brought about by fake client enter that has not been accounted for in the application’s code base (e.g., a telephone number info field doled out to the worth “Chucky”). Presently, paying little mind to the reason for the issue, the deciding result is that the application does not fill in as anticipated.

To outline the forthcoming discourse of organized special case taking care of, permit me to give definitions for three normally utilized peculiarity driven terms:

• Bugs: These are, basically, mistakes made by the software engineer. For instance, assume you are customizing with unmanaged C++. On the off chance that you neglect to erase progressively dispensed memory, bringing about a memory spill, you have a bug.

• User mistakes: User blunders, then again, are commonly brought about by the person running your application, instead of by the individuals who made it. For instance, an end client who enters a deformed string into a content box could exceptionally well create an blunder in the event that you neglect to handle this flawed info in your code base.

• Exceptions: Exceptions are commonly viewed as runtime abnormalities that are troublesome, if not inconceivable, to represent while programming your application. Conceivable special cases incorporate endeavoring to associate with a database that no more exists, opening an undermined XML record, or attempting to contact a machine that is presently disconnected from the net. In each of these cases, the developer (or end client) has little control over these “uncommon” circumstances.

Given these definitions, it ought to be clear that .NET organized special case taking care of is a procedure for managing runtime special cases. Notwithstanding, notwithstanding for the bugs and client mistakes that have gotten away your perspective, the CLR will frequently produce a relating special case that distinguishes the issue at hand. The .NET base class libraries characterize various special cases, for example, FormatException, IndexOutOfRangeException, FileNotFoundException, ArgumentOutOfRangeException, et cetera. Inside of the .NET terminology, a “special case” represents bugs, fake client data, and runtime blunders, despite the fact that we software engineers may see each of these as a particular issue. Be that as it may, before we get too a long ways in front of ourselves, how about we formalize the part of organized special case taking care of and look at how it contrasts from customary blunder taking care of systems.

To make the code samples utilized as a part of this book as spotless as could be allowed, I won’t get every conceivable exemption that may be tossed by a given system in the base class libraries. In your generation level ventures, you should, obviously, make liberal utilization of the systems introduced in this section. The Role of .NET Exception Handling Before .NET, mistake taking care of under the Windows working framework was a confounded jumble of strategies. Numerous developers moved their own blunder taking care of rationale inside of the connection of a given application. For instance, an advancement group could characterize an arrangement of numerical constants that spoken to known blunder conditions, and make utilization of them as technique return values.

By method for an illustration, consider the accompanying halfway C code:

/* A very C-style error trapping mechanism. */

#define E_FILENOTFOUND 1000

int SomeFunction()


// Assume something happens in this function

// that causes the following return value.



void main()


int retVal = SomeFunction();

if(retVal == E_FILENOTFOUND)

printf(“Cannot find file…”);


This methodology is not as much as perfect, given the way that the consistent E_FILENOTFOUND is minimal more than a numerical esteem, and is a long way from being a useful specialists in regards to how to manage the issue. In a perfect world, you might want to wrap the blunder’s name, an unmistakable message, and other accommodating data about this mistake condition into a solitary, all around characterized bundle (which is precisely what happens under organized exemption taking care of). Notwithstanding a designer’s impromptu methods, the Windows API characterizes several blunder codes that stop by method for #defines, HRESULTs, and excessively numerous minor departure from the straightforward Boolean (bool, BOOL, VARIANT_BOOL, etc). Moreover, numerous C++ COM designers (and by implication, numerous VB6 COM engineers) made utilization of a little arrangement of standard COM interfaces (e.g., ISupportErrorInfo, IErrorInfo, ICreateErrorInfo) to return important blunder data to a COM customer. The conspicuous issue with these more established methods is the gigantic absence of symmetry. Each methodology is pretty much custom-made to a given innovation, a given dialect, and maybe even a given venture. To put a conclusion to this frenzy, the .NET stage gives a standard method to send and trap runtime mistakes: organized special case taking care of (SEH). The excellence of this methodology is that designers now have a brought together way to deal with blunder taking care of, which is normal to all dialects focusing on the .NET stage. Along these lines, the route in which a C# software engineer handles mistakes is grammatically like that of a VB developer, or a C++ software engineer utilizing C++/CLI. If that wasn’t already enough, the language structure used to toss and catch special cases crosswise over congregations and machine limits is indistinguishable.


For more details and queries please feel free to email, visit or call us. Wishing you the very best for all your future endeavors.
Helpline: 9814666333, 8699444666

Please fill the form and we shall contact you soon.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s