Skip to content

Commit

Permalink
API TEST - Add Custom Exception Handler (#738)
Browse files Browse the repository at this point in the history
* - Add Custom Exception Handler

* - Update API Tester

* - Update Testcases
  • Loading branch information
haideriqbal authored Sep 12, 2024
1 parent 2f92121 commit 9cd6d32
Show file tree
Hide file tree
Showing 2,052 changed files with 4,107 additions and 2,060 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -345,19 +345,15 @@ public static JsonElement get(String url) throws IOException {
System.out.println("GET " + url);

HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
InputStream is = null;

if (100 <= conn.getResponseCode() && conn.getResponseCode() <= 399) {
InputStream is = conn.getInputStream();
Reader reader = new InputStreamReader(is, "UTF-8");
JsonElement result = JsonParser.parseReader(reader);
return result;
is = conn.getInputStream();
} else {
InputStream is = conn.getErrorStream();
Reader reader = new InputStreamReader(is, "UTF-8");
JsonObject error = new JsonObject();
error.addProperty("error", IOUtils.toString(is, StandardCharsets.UTF_8));
return error;
is = conn.getErrorStream();
}
Reader reader = new InputStreamReader(is, "UTF-8");
return JsonParser.parseReader(reader);
}

public JsonElement normalizeURLs(JsonElement element) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:31 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/annotation-properties-simple/entities/http%253A%252F%252Fwww.ebi.ac.uk%252Ftestcases%252Fannotation-properties%252Fsimple.owl%2523MyAnnotationProperty"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:31 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/data-property-domain-range-restrictions/classes/http%253A%252F%252Fwww.ebi.ac.uk%252Ftestcases%252Fowl2primer%252Fdata-property-domain-range-restrictions.rdf%2523Person"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:31 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/data-property-domain-range-restrictions/entities/http%253A%252F%252Fwww.ebi.ac.uk%252Ftestcases%252Fowl2primer%252Fdata-property-domain-range-restrictions.rdf%2523Person"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:31 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/data-property-domain-range-restrictions/entities/http%253A%252F%252Fwww.ebi.ac.uk%252Ftestcases%252Fowl2primer%252Fdata-property-domain-range-restrictions.rdf%2523hasAge"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FAPOLLO_SV_00000008"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FAPOLLO_SV_00000032"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FAPOLLO_SV_00000033"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FAPOLLO_SV_00000522"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FAPOLLO_SV_00000524"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FAPOLLO_SV_00000796"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000001"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000002"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000003"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000004"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000006"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000008"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000009"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000011"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000015"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000016"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000017"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000018"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000019"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000020"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000023"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000024"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000026"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000027"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000028"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000029"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000030"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000031"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000034"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000035"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000038"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000040"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000140"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000141"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"error": "<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Aug 30 13:21:46 BST 2024</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
"status": 404,
"message": "Endpoint not found: /api/ontologies/duo/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FBFO_0000142"
}
Loading

0 comments on commit 9cd6d32

Please sign in to comment.