From df514bfe346637b06537c227cc5cf039e262a9a5 Mon Sep 17 00:00:00 2001 From: Christian Glomb Date: Tue, 19 Nov 2024 11:13:38 +0100 Subject: [PATCH] Improve 404 --- tdd/common.py | 5 +++-- tdd/errors.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tdd/common.py b/tdd/common.py index 9a2c060..c4b6ef5 100644 --- a/tdd/common.py +++ b/tdd/common.py @@ -17,7 +17,7 @@ import subprocess import json import re -from flask import Response +from flask import Response, abort from tdd.sparql import ( @@ -136,5 +136,6 @@ def get_id_description(uri, content_type, ontology): if not resp.text.strip() or not ( re.search(r"^[^\#]", resp.text, re.MULTILINE) ): # because some SPARQL endpoint may send "# Empty file" as response - raise IDNotFound() + #raise IDNotFound() + abort(404) return resp.text diff --git a/tdd/errors.py b/tdd/errors.py index 93aec4b..526e3e6 100644 --- a/tdd/errors.py +++ b/tdd/errors.py @@ -193,7 +193,7 @@ def __init__(self, ld_content): class IDNotFound(AppException): - title = "ID Not Found" + title = "Not found" status_code = 404