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

dev.harrel.jsonschema.MetaSchemaResolvingException Maven / Gradle / Ivy

The newest version!
package dev.harrel.jsonschema;

/**
 * Exception type used to indicate meta-schema resolution failure.
 */
public class MetaSchemaResolvingException extends JsonSchemaException {
    private final String uri;

    private MetaSchemaResolvingException(String message, Throwable cause, String uri) {
        super(message, cause);
        this.uri = uri;
    }

    static MetaSchemaResolvingException resolvingFailure(String uri) {
        return new MetaSchemaResolvingException(String.format("Cannot resolve meta-schema [%s]", uri), null, uri);
    }

    static MetaSchemaResolvingException recursiveFailure(String uri) {
        return new MetaSchemaResolvingException(String.format("Parsing meta-schema [%s] failed - only dialects explicitly added to a validator can be recursive", uri), null, uri);
    }

    static MetaSchemaResolvingException parsingFailure(String uri, Throwable cause) {
        return new MetaSchemaResolvingException(String.format("Parsing meta-schema [%s] failed", uri), cause, uri);
    }

    /**
     * Meta-schema uri getter.
     * @return uri string for which the exception occurred
     */
    public String getUri() {
        return uri;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy