How is a raised exception different from a normal one and why would you use one. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How is a raised exception different from a normal one and why would you use one.

It is unclear how raising an exception is different than a normal exception or why you would use one. More description on the first slide in the section would be nice.

7th Mar 2017, 2:57 PM
Kevin
Kevin - avatar
2 Answers
+ 1
When handling an exception, you can want to refine the problem that occurred. That way, you can tell the user that a specific error occurred, or you do not want the parameters he has given...
7th Mar 2017, 9:46 PM
Amaras A
Amaras A - avatar
+ 1
There are no normal exceptions. All exceptions are raised. You can raise exceptions by hand to show that something specific to your program went wrong. Like you know, you automatically get exceptions, when you divide by 0, because that is bad input. Maybe there is bad input in your program. Maybe the eat method of your tiger class should never receive lemonade.
8th Mar 2017, 6:04 AM
1of3
1of3 - avatar