All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.allegro.tech.hermes.domain.subscription.SubscriptionAlreadyExistsException Maven / Gradle / Ivy

The newest version!
package pl.allegro.tech.hermes.domain.subscription;

import pl.allegro.tech.hermes.api.ErrorCode;
import pl.allegro.tech.hermes.api.Subscription;
import pl.allegro.tech.hermes.common.exception.HermesException;

public class SubscriptionAlreadyExistsException extends HermesException {

    public SubscriptionAlreadyExistsException(Subscription subscription, Throwable cause) {
        super(message(subscription), cause);
    }

    public SubscriptionAlreadyExistsException(Subscription subscription) {
        super(message(subscription));
    }

    @Override
    public ErrorCode getCode() {
        return ErrorCode.SUBSCRIPTION_ALREADY_EXISTS;
    }

    private static String message(Subscription subscription) {
        return String.format("Subscription %s for topic %s already exists.",
                subscription.getName(), subscription.getQualifiedTopicName());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy