Skip to content

Commit

Permalink
fix: HTTP EVENT ERROR management for unknown exception.
Browse files Browse the repository at this point in the history
  • Loading branch information
ofilangi committed May 17, 2022
1 parent d658645 commit 404a072
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ trait Rdf4jRequestDriver extends RequestDriver {
publish(DiscoveryRequestEvent(DiscoveryStateRequestEvent.ERROR_HTTP_REQUEST))
throw SWDiscoveryException(s"** RepositoryException **\ncon:$con\n${e.getMessage}")
case Failure(e) =>
publish(DiscoveryRequestEvent(DiscoveryStateRequestEvent.ERROR_HTTP_REQUEST))
throw SWDiscoveryException(s"** Unknown error ** \n${e.getMessage}")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,18 @@ object SWDiscoverySubscribeEventTest extends TestSuite {
.select(List("h1"))

swr.commit().raw.map( _=> assert(false))
.recover( a => {
.recover( _ => {
println(swr.currentRequestEvent)
assert(swr.currentRequestEvent == "ERROR_HTTP_REQUEST") } )
}

test("MalformedQueryException - ERROR_HTTP_REQUEST") {
val conf : SWDiscoveryConfiguration = SWDiscoveryConfiguration.init().rdfContent("<a> <b> <c> .")
SWDiscovery(conf).something("a").isObjectOf("some:toto").select(List("a"))
.commit().raw.map( _=> assert(false))
.recover( a => {
assert(a.getMessage.contains("MalformedQueryException"))
})
}
}
}

0 comments on commit 404a072

Please sign in to comment.