What is differnce between exception and error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

What is differnce between exception and error?

21st Aug 2018, 11:43 AM
Maninder $ingh
Maninder $ingh - avatar
7 Answers
+ 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.
21st Aug 2018, 12:06 PM
Teddy Okello
Teddy Okello - avatar
+ 2
i think its very same
7th Sep 2018, 10:12 AM
Real Gutch
Real Gutch - avatar
+ 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.
21st Aug 2018, 9:18 PM
Арсений Чеботарёв
Арсений Чеботарёв - avatar
+ 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
23rd Aug 2018, 8:32 AM
vamsikrishna.P
vamsikrishna.P - avatar
+ 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.
22nd Oct 2018, 12:59 AM
Roger Greenlaw
0
ULO MO MAY ERROR
23rd Aug 2018, 1:19 AM
Steven Claude R. Galvez
Steven Claude R. Galvez - avatar
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.
6th May 2019, 9:20 AM
Erwin Ansory