c# - Proper way to find the innermost exception? -
i'm working classes which, when throwing, have relatively deep innerexception tree. i'd log , act upon innermost exception 1 having real reason problem.
i'm using similar to
public static exception getinnermostexception(exception e) { while (e.innerexception != null) { e = e.innerexception; } return e; }
is proper way handle exception trees?
i think can innermost exception using following code:
public static exception getinnermostexception(exception e) { return e.getbaseexception(); }
Comments
Post a Comment