Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure QosReason cannot be null #929

Merged
merged 2 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/@unreleased/pr-929.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type: improvement
improvement:
description: Ensure QosReason cannot be provided as `null` by throwing an exception
immediately
links:
- https://github.com/palantir/conjure-java-runtime-api/pull/929
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.palantir.conjure.java.api.errors;

import com.palantir.logsafe.Arg;
import com.palantir.logsafe.Preconditions;
import com.palantir.logsafe.SafeArg;
import com.palantir.logsafe.SafeLoggable;
import com.palantir.logsafe.UnsafeArg;
Expand All @@ -39,12 +40,12 @@ public abstract class QosException extends RuntimeException {
// Not meant for external subclassing.
private QosException(String message, QosReason reason) {
super(message);
this.reason = reason;
this.reason = Preconditions.checkNotNull(reason, "QosReason is required");
}

private QosException(String message, Throwable cause, QosReason reason) {
super(message, cause);
this.reason = reason;
this.reason = Preconditions.checkNotNull(reason, "QosReason is required");
}

public final QosReason getReason() {
Expand Down