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

org.aksw.jena_sparql_api.http.HttpExceptionUtils Maven / Gradle / Ivy

The newest version!
package org.aksw.jena_sparql_api.http;

import org.apache.jena.atlas.web.HttpException;

import org.apache.jena.sparql.engine.http.QueryExceptionHTTP;

public class HttpExceptionUtils {
    public static RuntimeException makeHumanFriendly(Exception e) {
        RuntimeException result;
        if(e instanceof HttpException) {
            HttpException x = (HttpException)e;
            result = new HttpException(x.getResponse(), e);
        } else if(e instanceof QueryExceptionHTTP) {
            QueryExceptionHTTP x = (QueryExceptionHTTP)e;
            result = new QueryExceptionHTTP(x.getResponse() + " " + x.getMessage(), e);
        } else {
            result = new RuntimeException(e);
        }

        return result;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy