Error Code - Error Codes and Exception Handling

Error Codes and Exception Handling

Error codes are slowly disappearing from the programmer's environment as modern object-oriented programming languages replace them with exceptions. Exceptions have the advantage of being handled with explicit blocks of code, separate from the rest of the code. While it is considered poor practice in methodologies that use error codes and return codes to indicate failure, programmers often neglect to check return values for error conditions. That negligence can cause undesirable effects, as ignored error conditions often cause more severe problems later in the program. Exceptions are implemented in such a way as to separate the error handling code from the rest of the code. Separating the error handling code from the normal logic makes programs easier to write and understand, since one block of error handling code can service errors from any number of function calls. Exception handling also makes the code more readable than implementations with error codes, since exception handling does not disrupt the flow of the code with frequent checks for error conditions.

Read more about this topic:  Error Code

Famous quotes containing the words error, codes, exception and/or handling:

    Children, then, acquire social skills not so much from adults as from their interactions with one another. They are likely to discover through trial and error which strategies work and which do not, and later to reflect consciously on what they have learned.
    Zick Rubin (20th century)

    We must trust infinitely to the beneficent necessity which shines through all laws. Human nature expresses itself in them as characteristically as in statues, or songs, or railroads, and an abstract of the codes of nations would be an abstract of the common conscience.
    Ralph Waldo Emerson (1803–1882)

    It has no share in the leadership of thought: it does not even reflect its current. It does not create beauty: it apes fashion. It does not produce personal skill: our actors and actresses, with the exception of a few persons with natural gifts and graces, mostly miscultivated or half-cultivated, are simply the middle-class section of the residuum.
    George Bernard Shaw (1856–1950)

    Madam, a circulating library in a town is as an evergreen tree of diabolical knowledge; it blossoms through the year. And depend on it ... that they who are so fond of handling the leaves, will long for the fruit at last.
    Richard Brinsley Sheridan (1751–1816)