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:

    Mistakes are a fact of life
    It is the response to error that counts.
    Nikki Giovanni (b. 1943)

    ... until both employers’ and workers’ groups assume responsibility for chastising their own recalcitrant children, they can vainly bay the moon about “ignorant” and “unfair” public criticism. Moreover, their failure to impose voluntarily upon their own groups codes of decency and honor will result in more and more necessity for government control.
    Mary Barnett Gilson (1877–?)

    Let’s face it. With the singular exception of breast-feeding, there is nothing about infant care that a mother is innately better qualified to do than a father. Yet we continue to unconsciously perpetuate the myth that men just don’t have what it takes to be true partners in the process.
    Michael K. Meyerhoff (20th century)

    For a novel addressed by a man to men and women of full age; which attempts to deal unaffectedly with the fret and fever, derision and disaster, that may press in the wake of the strongest passion known to humanity; to tell, without a mincing of words, of a deadly war waged between flesh and spirit; and to point the tragedy of unfulfilled aims, I am not aware that there is anything in the handling to which exception can be taken.
    Thomas Hardy (1840–1928)