@@ -1028,18 +1028,24 @@ class HttpTriplestoreConnector extends Actor with ActorLogging with Instrumentat
10281028 val response = client.execute(targetHost, request, context)
10291029 maybeResponse = Some (response)
10301030 val statusCode : Int = response.getStatusLine.getStatusCode
1031- val statusCategory : Int = statusCode / 100
10321031
1033- if (statusCategory != 2 ) {
1034- Option (response.getEntity)
1035- .map(responseEntity => EntityUtils .toString(responseEntity, StandardCharsets .UTF_8 )) match {
1036- case Some (responseEntityStr) =>
1037- log.error(s " Triplestore responded with HTTP code $statusCode: $responseEntityStr" )
1038- throw TriplestoreResponseException (s " Triplestore responded with HTTP code $statusCode: $responseEntityStr" )
1039-
1040- case None =>
1041- log.error(s " Triplestore responded with HTTP code $statusCode" )
1042- throw TriplestoreResponseException (s " Triplestore responded with HTTP code $statusCode" )
1032+ if (statusCode == 404 ) {
1033+ throw NotFoundException (" The requested data was not found" )
1034+ } else {
1035+ val statusCategory : Int = statusCode / 100
1036+
1037+ if (statusCategory != 2 ) {
1038+ Option (response.getEntity)
1039+ .map(responseEntity => EntityUtils .toString(responseEntity, StandardCharsets .UTF_8 )) match {
1040+ case Some (responseEntityStr) =>
1041+ log.error(s " Triplestore responded with HTTP code $statusCode: $responseEntityStr" )
1042+ throw TriplestoreResponseException (
1043+ s " Triplestore responded with HTTP code $statusCode: $responseEntityStr" )
1044+
1045+ case None =>
1046+ log.error(s " Triplestore responded with HTTP code $statusCode" )
1047+ throw TriplestoreResponseException (s " Triplestore responded with HTTP code $statusCode" )
1048+ }
10431049 }
10441050 }
10451051
@@ -1061,6 +1067,8 @@ class HttpTriplestoreConnector extends Actor with ActorLogging with Instrumentat
10611067 log.error(socketTimeoutException, message)
10621068 throw TriplestoreTimeoutException (message = message, e = socketTimeoutException, log = log)
10631069
1070+ case notFound : NotFoundException => throw notFound
1071+
10641072 case e : Exception =>
10651073 val message = " Failed to connect to triplestore"
10661074 log.error(e, message)
0 commit comments