-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API ServiceBusErrorSource to represent source of error (#16710)
ErrorSource to populate when autocomplete is on and for processor model.
- Loading branch information
1 parent
3b5d04c
commit 249ecc1
Showing
5 changed files
with
297 additions
and
20 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...ging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusAmqpException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.messaging.servicebus; | ||
|
||
import com.azure.core.amqp.exception.AmqpException; | ||
|
||
/** | ||
* Defines {@link ServiceBusAmqpException} which has additional information about the operation that caused the error. | ||
* | ||
* @see ServiceBusErrorSource | ||
*/ | ||
public final class ServiceBusAmqpException extends AmqpException { | ||
private final transient ServiceBusErrorSource errorSource; | ||
|
||
/** | ||
* @param amqpException for the error hapened. | ||
* @param errorSource indicating which api caused the error. | ||
*/ | ||
ServiceBusAmqpException(AmqpException amqpException, ServiceBusErrorSource errorSource) { | ||
super(amqpException.isTransient(), amqpException.getErrorCondition(), amqpException.getMessage(), | ||
amqpException.getCause(), amqpException.getContext()); | ||
this.errorSource = errorSource; | ||
} | ||
|
||
/** | ||
* Gets the {@link ServiceBusErrorSource} in case of any errors. | ||
* | ||
* @return the {@link ServiceBusErrorSource} | ||
*/ | ||
public ServiceBusErrorSource getErrorSource() { | ||
return errorSource; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...saging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusErrorSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.messaging.servicebus; | ||
|
||
import com.azure.core.util.ExpandableStringEnum; | ||
|
||
/** | ||
* Represent the operation this sdk was performing when the error happened. | ||
*/ | ||
public final class ServiceBusErrorSource extends ExpandableStringEnum<ServiceBusErrorSource> { | ||
|
||
/** Error while abandoning the message.*/ | ||
public static final ServiceBusErrorSource ABANDONED = fromString("ABANDONED", ServiceBusErrorSource.class); | ||
|
||
/** Error while completing the message.*/ | ||
public static final ServiceBusErrorSource COMPLETE = fromString("COMPLETE", ServiceBusErrorSource.class); | ||
|
||
/** Error while receiving the message(s).*/ | ||
public static final ServiceBusErrorSource RECEIVE = fromString("RECEIVE", ServiceBusErrorSource.class); | ||
|
||
/** Error while renewing lock.*/ | ||
public static final ServiceBusErrorSource RENEW_LOCK = fromString("RENEW_LOCK", ServiceBusErrorSource.class); | ||
|
||
/** Error when we could not determine the source.*/ | ||
public static final ServiceBusErrorSource UNKNOWN = fromString("UNKNOWN", ServiceBusErrorSource.class); | ||
|
||
/** Error while user's code is running for a message.*/ | ||
public static final ServiceBusErrorSource USER_CALLBACK = fromString("USER_CALLBACK", | ||
ServiceBusErrorSource.class); | ||
|
||
/** Error while session is accepted.*/ | ||
public static final ServiceBusErrorSource ACCEPT_SESSION = fromString("ACCEPT_SESSION", | ||
ServiceBusErrorSource.class); | ||
|
||
/** Error while session is closed.*/ | ||
public static final ServiceBusErrorSource CLOSE_SESSION = fromString("CLOSE_SESSION", | ||
ServiceBusErrorSource.class); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.