Skip to content
Snippets Groups Projects
Commit d5d47866 authored by Nikhil Singh[MicroSoft]'s avatar Nikhil Singh[MicroSoft]
Browse files

Commit 25 Contents:

1-Update Error Message
parent ae7d4c4c
No related branches found
No related tags found
2 merge requests!102Locking down maven central,!97Service Bus Create and Delete Support for Subscriptions
Pipeline #55297 failed
......@@ -138,7 +138,6 @@ public class SubscriptionRepository implements ISubscriptionRepository {
}
} catch (AppException e) {
if (e.getError().getCode() == 409) {
// TODO:This exception is not created in flow of delete
logger.error("Another request is trying to delete the same subscription");
throw new AppException(409, "Conflict", "Another request is trying to delete the same subscription");
} else if (e.getMessage().equals(String.format("Subscriber with id %s does not exist.", id))) {
......
......@@ -28,8 +28,7 @@ import org.springframework.stereotype.Component;
@Component
@ConditionalOnProperty(value = "azure.serviceBus.enabled", havingValue = "true", matchIfMissing = true)
public class PullSubscription implements IPubsubSubscription {
// TODO: UPDATE ERROR_MESSAGE FOR SERVICE BUS
private static final String RESOURCE_PROVISIONING_ERROR_MESSAGE = "Resource cannot be updated during provisioning";
private static final String RESOURCE_PROVISIONING_ERROR_MESSAGE = "Resource Conflict Occurred. Another conflicting operation may be in progress";
@Autowired
private IManagementClientFactory factory;
@Autowired
......@@ -43,14 +42,13 @@ public class PullSubscription implements IPubsubSubscription {
managementClient.createSubscription(topicAliasName, subscriptionId);
logger.debug(String.format("Pull Subscription with id %s created successfully", subscriptionId));
} catch (Exception e) {
if (e.getMessage().equals(RESOURCE_PROVISIONING_ERROR_MESSAGE)) {
if (e.getMessage().contains(RESOURCE_PROVISIONING_ERROR_MESSAGE)) {
logger.error("Another request is trying to create the same Pull subscription");
throw new AppException(409, "Conflict", "Another request is trying to create the same Pull subscription");
} else if (e instanceof MessagingEntityAlreadyExistsException) {
logger.error(String.format("Pull Subscription with id %s already exist.", subscriptionId));
throw new AppException(500, "Server Error", "Pull Subscription already exists");
}
else {
} else {
logger.error("Creating Pull Subscription failed with error: " + e.toString());
throw new AppException(500, "Server Error", "Unexpected error creating Pull subscription");
}
......@@ -63,7 +61,10 @@ public class PullSubscription implements IPubsubSubscription {
managementClient.deleteSubscription(topicAliasName, subscriptionId);
logger.debug(String.format("Pull Subscription with id %s deleted successfully", subscriptionId));
} catch (Exception e) {
if (e instanceof MessagingEntityNotFoundException) {
if (e.getMessage().contains(RESOURCE_PROVISIONING_ERROR_MESSAGE)) {
logger.error("Another request is trying to delete the same Pull subscription");
throw new AppException(409, "Conflict", "Another request is trying to delete the same Pull subscription");
} else if (e instanceof MessagingEntityNotFoundException) {
logger.error(String.format("Pull Subscription with id %s does not exist.", subscriptionId));
throw new AppException(404, "Not found", String.format("Pull Subscription with id %s does not exist.", subscriptionId));
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment