+ 4
What is differnce between exception and error?
7 Respuestas
+ 9
[python]
Errors are problems encountered during the compilation and execution of a program. They can occur due to wrong syntax, inappropriate use of keywords and datatypes.
Exceptions are used to "catch" the errors when they occur. They can act as if and elif statements because the execute some extra code only if the error is encountered. This prevents the program from crashing.
It is the equivalent of the police protocol on what to do incase an offender starts shooting instead of surrendering as ordered. The police does not freeze when the offender does not follow orders.
For example, a progran can expect a number, but a letter is entered. This will cause a TypeError. We can place an exeption for this type of error, so that when it is encountered, it tells the user they entered a wrong thing and asks for another entry.
+ 2
i think its very same
+ 1
Error is common term to describe situation, which you or computer, or both, can qualify as Wrong. This may be unapropriate code constructs, unexpected results of calculatoons, or whatever. Exceptions is special means to process such situations. One may say it is a little sugar around run time errors (two other are compile time, or syntax errors, and logical, or they say symantic). However we need to say exceptions are lay in core of many operating systems (if not all), have direct hardware support, and often are only the way to go (for example to call privileged ring. Anyway exceptions are just a mechanics to handle runtime errors.
+ 1
An Error indicates serious problems that a reasonable application should not try to catch.
An Exception "indicates conditions that a reasonable application might want to catch." Error along with Run time Exception & their sub classes are unchecked exceptions
+ 1
In C++ an error either prevents successful compile of a program or crashes the program during execution. An exception is a condition you are aware of which would crash the program or result in incorrect information being presented or stored after calculations. Exception handling is writing code that will automatically be executed if an exception condition occurs in the program. This will prevent bad input from possibly crashing the program or trashing a data file.
0
ULO MO MAY ERROR
0
Error indicate to the fault of the code, and exception is to change/manipulate error' indication that built in the programming language software, mostly used in input processing.