asp.net - Custom Exception class doesn't work -
why classes inerithes system.exception
don't work in try catch block?
the following snipped doesn't fire catch block
try { int = 3; int b = 0; int c = a/b; } catch (customex er) { console.write(er.message); } public class customex:exception { }
the code provided cannot work because division throws dividebyzeroexception
, you're catching customex
inherits exception
not dividebyzeroexception
.
Comments
Post a Comment