Search in sources :

Example 1 with LocationHintException

use of org.n52.janmayen.exception.LocationHintException in project arctic-sea by 52North.

the class KvpBinding method toOwsExceptionReport.

private OwsExceptionReport toOwsExceptionReport(Throwable ex) {
    if (ex instanceof OwsExceptionReport) {
        return (OwsExceptionReport) ex;
    }
    Throwable cause = ex.getCause();
    if (cause instanceof OwsExceptionReport) {
        return (OwsExceptionReport) cause;
    }
    if (ex instanceof CompositeException) {
        return toOwsExceptionReport((CompositeException) ex);
    }
    if (cause instanceof CompositeException) {
        return toOwsExceptionReport((CompositeException) cause);
    }
    String location = null;
    if (ex instanceof LocationHintException) {
        location = ((LocationHintException) ex).getLocation().orElse(null);
    } else if (cause instanceof LocationHintException) {
        location = ((LocationHintException) cause).getLocation().orElse(null);
    }
    return new InvalidParameterValueException().withMessage(ex.getMessage()).causedBy(ex).at(location);
}
Also used : LocationHintException(org.n52.janmayen.exception.LocationHintException) InvalidParameterValueException(org.n52.shetland.ogc.ows.exception.InvalidParameterValueException) CompositeException(org.n52.janmayen.exception.CompositeException) OwsExceptionReport(org.n52.shetland.ogc.ows.exception.OwsExceptionReport)

Aggregations

CompositeException (org.n52.janmayen.exception.CompositeException)1 LocationHintException (org.n52.janmayen.exception.LocationHintException)1 InvalidParameterValueException (org.n52.shetland.ogc.ows.exception.InvalidParameterValueException)1 OwsExceptionReport (org.n52.shetland.ogc.ows.exception.OwsExceptionReport)1