Given: Throwable
is Exception
's superclass.
When I read texts on writing your own 'exceptions', I see examples of Throwable
being used in the catch
block and other texts show new Exception()
being used in the catch
block. I have yet to see an explanation of when one should use each.
My question is this, when should Throwable
be used and when should new Exception()
be used?
Inside the catch
or else
block using either:
throw throwable;
or
throw new Exception();
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…