File tree Expand file tree Collapse file tree 3 files changed +11
-0
lines changed
azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 1313public final class AmqpConstants {
1414
1515 public static final String APACHE = "apache.org" ;
16+ public static final String PROTON = "proton" ;
1617 public static final String VENDOR = "com.microsoft" ;
1718 public static final String AMQP_ANNOTATION_FORMAT = "amqp.annotation.%s >%s '%s'" ;
1819 public static final String OFFSET_ANNOTATION_NAME = "x-opt-offset" ;
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ public final class ClientConstants {
2020 public final static Symbol STORE_LOCK_LOST_ERROR = Symbol .getSymbol (AmqpConstants .VENDOR + ":store-lock-lost" );
2121 public final static Symbol PUBLISHER_REVOKED_ERROR = Symbol .getSymbol (AmqpConstants .VENDOR + ":publisher-revoked" );
2222 public final static Symbol TIMEOUT_ERROR = Symbol .getSymbol (AmqpConstants .VENDOR + ":timeout" );
23+ public final static Symbol PROTON_IO_ERROR = Symbol .getSymbol (AmqpConstants .PROTON + ":io" );
2324 public final static Symbol TRACKING_ID_PROPERTY = Symbol .getSymbol (AmqpConstants .VENDOR + ":tracking-id" );
2425 public static final int MAX_MESSAGE_LENGTH_BYTES = 256 * 1024 ;
2526 public static final int MAX_FRAME_SIZE_BYTES = 64 * 1024 ;
@@ -76,6 +77,9 @@ public final class ClientConstants {
7677 public static final String TOKEN_AUDIENCE_FORMAT = "amqp://%s/%s" ;
7778 public static final String HTTPS_URI_FORMAT = "https://%s:%s" ;
7879 public static final int MAX_RECEIVER_NAME_LENGTH = 64 ;
80+
81+ public static final String COMMUNICATION_EXCEPTION_GENERIC_MESSAGE = "A communication error has occurred. " +
82+ "This may be due to an incorrect host name in your connection string or a problem with your network connection." ;
7983
8084 /**
8185 * This is a constant defined to represent the start of a partition stream in EventHub.
Original file line number Diff line number Diff line change @@ -55,6 +55,12 @@ static Exception toException(ErrorCondition errorCondition) {
5555 return new EventHubException (true , new AmqpException (errorCondition ));
5656 } else if (errorCondition .getCondition () == AmqpErrorCode .ResourceLimitExceeded ) {
5757 return new QuotaExceededException (new AmqpException (errorCondition ));
58+ } else if (errorCondition .getCondition () == ClientConstants .PROTON_IO_ERROR ) {
59+ String message = ClientConstants .COMMUNICATION_EXCEPTION_GENERIC_MESSAGE ;
60+ if (errorCondition .getDescription () != null ) {
61+ message = errorCondition .getDescription ();
62+ }
63+ return new CommunicationException (message , null );
5864 }
5965
6066 return new EventHubException (ClientConstants .DEFAULT_IS_TRANSIENT , errorCondition .getDescription ());
You can’t perform that action at this time.
0 commit comments