Skip to content

Conversation

@carterkozak
Copy link
Contributor

Before this PR

The render method threw a NPE when an argument value was null. This exception destroys our ability to capture the root cause -- we must either set the original as a cause/suppressed-cause or provide as much data as possible.

It's clearly not ideal to have null arg values, however it's even worse if we're unable to diagnose the original problem based on logging, so we mustn't be opinionated here.

After this PR

==COMMIT_MSG==
ServiceException no longer throws NPE when null args are provided
==COMMIT_MSG==

See palantir/safe-logging#492

Possible downsides?

none.

@changelog-app
Copy link

changelog-app bot commented Sep 10, 2020

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

ServiceException no longer throws NPE when null args are provided

Check the box to generate changelog(s)

  • Generate changelog entry

} else {
builder.append(", ");
}
builder.append(arg.getName()).append("=").append(arg.getValue());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to keep the information that an arg was null in the message? E.g. rendering something like {arg1=null}? That way you could see that something went wrong passing through the args when inspecting the logs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that tells us anything, and we would have to use a funky argument name to prevent duplication with user-provided arg names.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!

@carterkozak
Copy link
Contributor Author

🤖🍿

@bulldozer-bot bulldozer-bot bot merged commit 1650414 into develop Sep 10, 2020
@bulldozer-bot bulldozer-bot bot deleted the ckozak/serviceexception_resilient_to_null_args branch September 10, 2020 16:34
@svc-autorelease
Copy link
Collaborator

Released 2.16.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants