whats is 'Exception e'??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

whats is 'Exception e'???

14th Feb 2018, 3:15 PM
Amol Narayan Dhumal
Amol Narayan Dhumal - avatar
5 Answers
+ 28
what is exception e ? an exception is an error and it can be handled but how ? here is some ways except some_exception as what_ever_name_you_want or you can also do this except Exception the except Exception in python handles any exception but how can you handle exceptions ? except Exception as : print('your error message to the user {}'.format(e)) if that doesn't work then try this print(str(e)) here is some examples https://code.sololearn.com/chWLlIvIVFgB/?ref=app https://code.sololearn.com/c4yJ1i26gdW2/?ref=app All built-in errors in python by Oma Falk https://code.sololearn.com/cZdbwQPVZvmF/?ref=app
14th Feb 2018, 9:46 PM
warlord
warlord - avatar
+ 1
the 'e' is object of Exception class.you can use 'e' object to get exception in your class.
26th Feb 2018, 4:50 AM
Lalji Lilapara
0
Hi, the Exception is a class ! that you can put it in a catch() to catch any types of exceptions, and e is just a variable of type Exception class that whenever an exception occurred you can use your e to handle the occurred error ! ex: try { ... } catch(Exception e){ System.out.print(e.getMessage()); }
22nd Mar 2018, 8:39 AM
Saeid Saati
Saeid Saati - avatar
0
its a param of the catch statement, Exception means that the block will handle any type of exception, and not an especific one, end "e" is the variable method that will be used to refer the exception
9th Apr 2018, 1:55 AM
Joao Luiz de Castro
Joao Luiz de Castro - avatar