You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Item 75: Include failure-capture information in detail messages
Key Points
Detail message is an exception's string representation, i.e. the output of
its toString method.
Detail message of an exception should contain the values of all parameters
and fields that contributed to the exception, excluding security-sensitive
information like passwords or encryption keys.
e.g. IndexOutOfBoundsException with:
the lower bound
the upper bound
the index value that failed to lie between the bounds.
adequately captures the failure for debugging.
Providing an appropriate constructor that requires failure-capture
information is a good way to ensure informative detail messages.