Open vga91 opened 4 months ago
Currently, it does not seem possible to solve the issue by acting on APOC Extended, it would be necessary to modify APOC Core.
The following solution (i.e. the one provided in the internal APOC core Trello with id G2oExgfb
) would solve the issue:
// placed in StreamCollection.UrlStreamConnection class by replacing the present method
@Override
public InputStream getInputStream() throws IOException {
if (con instanceof HttpURLConnection httpConn && httpConn.getResponseCode() >= 400)
{
// return ErrorStream as a RuntimeException
String errMsg = new String(httpConn.getErrorStream().readAllBytes());
throw new RuntimeException("Error during HTTP call:\n" + errMsg);
}
return toLimitedIStream(con.getInputStream(), getLength());
}
By returning the following output in case of an existing collection:
org.neo4j.graphdb.QueryExecutionException:
Failed to invoke procedure `apoc.vectordb.weaviate.createCollection`: Caused by: java.lang.RuntimeException: Error during HTTP call:
{"error":[{"message":"class name \"TestCollection\" already exists"}]}
Examples of test case to update after the above fixes: https://github.com/neo4j-contrib/neo4j-apoc-procedures/commit/99e6025f9a2462d39f48637c42b3cb60647f9441
The following procedure should return the root cause (i.e. the collection already exists):
Procedure errors to handle and improve: