When to log a stacktrace for a caught exception

后端 未结 5 1119
萌比男神i
萌比男神i 2020-12-02 00:51

I recently asked whether to report the getMessage() text of a caught exception. Rather surprisingly, most answers misunderstood my question and thought I was asking whether

5条回答
  •  暖寄归人
    2020-12-02 01:24

    It's context dependent. For example, I might not log / report a ParseException from NumberFormat when parsing input from an external system, but I would definitely do so if I caught a ParseException which was dealing with data enclosed within the boundary of my system, since this would indicate an inconsistency in internal system state rather than an input value validation falure.

提交回复
热议问题