0

What is the use of raising exceptions?

I tried but failed to understand.

3rd Aug 2020, 1:59 PM
Bihari Launda
Bihari Launda - avatar
7 Respuestas
+ 6
Notice how you can write the error message with more information inside the parentheses. name = "123" try: raise NameError("Invalid name!") except NameError: print('NameError : "Invalid name!"') __________________________ Notice you can even do this way: name = "123" try: raise NameError except NameError: print('NameError : "Invalid name!"') Read this article: https://geek-university.com/JUMP_LINK__&&__python__&&__JUMP_LINK/raise-exception/
3rd Aug 2020, 2:20 PM
minirkk
minirkk - avatar
3rd Aug 2020, 2:11 PM
minirkk
minirkk - avatar
+ 1
rohit in simple word raise allows you to raise your own exceptions?
3rd Aug 2020, 2:09 PM
Bihari Launda
Bihari Launda - avatar
+ 1
rohit the raise statement can be used without arguments to re-raise whatever exception occurred. Could you explain this line?
3rd Aug 2020, 2:12 PM
Bihari Launda
Bihari Launda - avatar
+ 1
rohit We can use the raise keyword to signal that the situation is exceptional to the normal flow.
3rd Aug 2020, 2:29 PM
Bihari Launda
Bihari Launda - avatar
0
Am i correct or not?
3rd Aug 2020, 2:09 PM
Bihari Launda
Bihari Launda - avatar