Skip to content

Commit

Permalink
Remove put token messaging on request failures (#346)
Browse files Browse the repository at this point in the history
  • Loading branch information
sabeegrewal authored and sjkwak committed Jun 29, 2018
1 parent c973967 commit b6dda54
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public final class ClientConstants {
public static final Symbol LAST_ENQUEUED_SEQUENCE_NUMBER = Symbol.valueOf(MANAGEMENT_RESULT_LAST_ENQUEUED_SEQUENCE_NUMBER);
public static final Symbol LAST_ENQUEUED_OFFSET = Symbol.valueOf(MANAGEMENT_RESULT_LAST_ENQUEUED_OFFSET);
public static final Symbol LAST_ENQUEUED_TIME_UTC = Symbol.valueOf(MANAGEMENT_RESULT_LAST_ENQUEUED_TIME_UTC);
public static final String AMQP_PUT_TOKEN_FAILED_ERROR = "Put token failed. status-code: %s, status-description: %s";
public static final String AMQP_REQUEST_FAILED_ERROR = "status-code: %s, status-description: %s";
public static final String TOKEN_AUDIENCE_FORMAT = "amqp://%s/%s";
public static final int MAX_RECEIVER_NAME_LENGTH = 64;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ static Exception toException(ErrorCondition errorCondition) {
static Exception amqpResponseCodeToException(final int statusCode, final String statusDescription) {
final AmqpResponseCode amqpResponseCode = AmqpResponseCode.valueOf(statusCode);
if (amqpResponseCode == null)
return new EventHubException(true, String.format(ClientConstants.AMQP_PUT_TOKEN_FAILED_ERROR, statusCode, statusDescription));
return new EventHubException(true, String.format(ClientConstants.AMQP_REQUEST_FAILED_ERROR, statusCode, statusDescription));

switch (amqpResponseCode) {
case BAD_REQUEST:
return new IllegalArgumentException(String.format(ClientConstants.AMQP_PUT_TOKEN_FAILED_ERROR, statusCode, statusDescription));
return new IllegalArgumentException(String.format(ClientConstants.AMQP_REQUEST_FAILED_ERROR, statusCode, statusDescription));
case NOT_FOUND:
return new IllegalEntityException(statusDescription);
case FORBIDDEN:
return new QuotaExceededException(String.format(ClientConstants.AMQP_PUT_TOKEN_FAILED_ERROR, statusCode, statusDescription));
return new QuotaExceededException(String.format(ClientConstants.AMQP_REQUEST_FAILED_ERROR, statusCode, statusDescription));
case UNAUTHORIZED:
return new AuthorizationFailedException(String.format(ClientConstants.AMQP_PUT_TOKEN_FAILED_ERROR, statusCode, statusDescription));
return new AuthorizationFailedException(String.format(ClientConstants.AMQP_REQUEST_FAILED_ERROR, statusCode, statusDescription));
default:
return new EventHubException(true, String.format(ClientConstants.AMQP_PUT_TOKEN_FAILED_ERROR, statusCode, statusDescription));
return new EventHubException(true, String.format(ClientConstants.AMQP_REQUEST_FAILED_ERROR, statusCode, statusDescription));
}
}

Expand Down

0 comments on commit b6dda54

Please sign in to comment.