diff --git a/backend/src/main/java/eu/clarin/switchboard/core/LinkMetadata.java b/backend/src/main/java/eu/clarin/switchboard/core/LinkMetadata.java index f95d739e0..b202af8ac 100644 --- a/backend/src/main/java/eu/clarin/switchboard/core/LinkMetadata.java +++ b/backend/src/main/java/eu/clarin/switchboard/core/LinkMetadata.java @@ -67,6 +67,11 @@ public static LinkInfo getLinkData(CloseableHttpClient client, String originalUr throw new LinkException(LinkException.Kind.DATA_STREAM_ERROR, "" + linkInfo.downloadLink, xc); } + int status = response.getStatusLine().getStatusCode(); + if (status >= 400) { + throw new LinkException(LinkException.Kind.STATUS_ERROR, "" + linkInfo.downloadLink, status); + } + switch (context.getCacheResponseStatus()) { case CACHE_HIT: LOGGER.debug("A response was generated from the cache with no requests sent upstream");