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

com.azure.messaging.eventhubs.models.ErrorContext Maven / Gradle / Ivy

There is a newer version: 5.19.2
Show newest version
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.messaging.eventhubs.models;

import com.azure.core.annotation.Immutable;
import java.util.Objects;

/**
 * This class contains information about an error that occurred while processing events.
 */
@Immutable
public class ErrorContext {
    private final PartitionContext partitionContext;
    private final Throwable throwable;

    /**
     * Creates a new instance of ErrorContext.
     *
     * @param partitionContext The partition information where the error occurred.
     * @param throwable The {@link Throwable error} that occurred.
     * @throws NullPointerException if {@code partitionContext} or {@code throwable} is {@code null}.
     */
    public ErrorContext(final PartitionContext partitionContext, final Throwable throwable) {
        this.partitionContext = Objects.requireNonNull(partitionContext, "'partitionContext' cannot be null");
        this.throwable = Objects.requireNonNull(throwable, "'throwable' cannot be null");
    }

    /**
     * Returns the partition information where the error occurred.
     *
     * @return The partition information where the error occurred.
     */
    public PartitionContext getPartitionContext() {
        return partitionContext;
    }

    /**
     * Returns the error that occurred during event processing.
     *
     * @return The error that occurred during event processing.
     */
    public Throwable getThrowable() {
        return throwable;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy