0

I didn't understand the use of catch(...) statement in exception handling. Can somebody explain this?

what is the difference between "catch(exception name)" and "catch(...)"

26th Sep 2017, 7:17 AM
KKS Junior
KKS Junior - avatar
4 Answers
+ 10
catch − A program catches an exception with an exception handler at the place in a program where you want to handle the problem. The catch keyword indicates the catching of an exception. try { // protected code } catch( ExceptionName e1 ) { // catch block } catch( ExceptionName e2 ) { // catch block } catch( ExceptionName eN ) { // catch block }
26th Sep 2017, 7:20 AM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
+ 7
try{ if(x =="")throw "empty" } catch(err){ x.innerHTML=err } with try you can try code and catch is catch your error in this example i create custom error when input is empty read this link https://www.w3schools.com/js/js_errors.asp
26th Sep 2017, 8:09 AM
Mahdi Momeni
Mahdi Momeni - avatar
0
my question was catch(...). catch with ellipses in it...
26th Sep 2017, 7:29 AM
KKS Junior
KKS Junior - avatar