+ 6
whats is 'Exception e'???
5 Antworten
+ 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
+ 8
https://www.sololearn.com/learn/CSharp/2690/
https://www.sololearn.com/learn/CPlusPlus/1918/
https://www.sololearn.com/learn/Java/2175/
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2440/
+ 1
the 'e' is object of Exception class.you can use 'e' object to get exception in your class.
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());
}
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