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

com.oembedler.moon.graphql.boot.error.ThrowableGraphQLError Maven / Gradle / Ivy

The newest version!
package com.oembedler.moon.graphql.boot.error;

import graphql.servlet.GenericGraphQLError;

import java.util.Objects;

public class ThrowableGraphQLError extends GenericGraphQLError {

    private final Throwable throwable;

    public ThrowableGraphQLError(Throwable throwable) {
        this(throwable, throwable.getMessage());
    }

    public ThrowableGraphQLError(Throwable throwable, String message) {
        super(message);

        this.throwable = throwable;
    }

    public String getType() {
        return throwable.getClass().getSimpleName();
    }

    @Override
    public final boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ThrowableGraphQLError)) return false;
        ThrowableGraphQLError that = (ThrowableGraphQLError) o;
        return Objects.equals(throwable, that.throwable) && Objects.equals(getMessage(), that.getMessage());
    }

    @Override
    public final int hashCode() {
        return Objects.hash(throwable, getMessage());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy