Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #209: Add error message in case no matching map frame could be found #228

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions sketch_map_tool/database/client_celery.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
import json
from io import BytesIO
from uuid import UUID

import psycopg2
from psycopg2.extensions import connection
from werkzeug.utils import secure_filename

from sketch_map_tool.config import get_config_value
from sketch_map_tool.definitions import REQUEST_TYPES
from sketch_map_tool.exceptions import FileNotFoundError_, UUIDNotFoundError
from sketch_map_tool.exceptions import FileNotFoundError_

db_conn: connection | None = None




def open_connection():
global db_conn
raw = get_config_value("result-backend")
Expand Down Expand Up @@ -64,7 +59,8 @@ def select_file(id_: int) -> bytes:
return raw[0]
else:
raise FileNotFoundError_(
"There is no file in the database with the id: " + str(id_))
"There is no file in the database with the id: " + str(id_)
)


def delete_file(id_: int):
Expand Down
2 changes: 2 additions & 0 deletions sketch_map_tool/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from sketch_map_tool.database import client_flask as db_client_flask
from sketch_map_tool.definitions import REQUEST_TYPES
from sketch_map_tool.exceptions import (
FileNotFoundError_,
MapGenerationError,
OQTReportError,
QRCodeError,
Expand Down Expand Up @@ -215,6 +216,7 @@ def download(uuid: str, type_: REQUEST_TYPES) -> Response:


@app.errorhandler(QRCodeError)
@app.errorhandler(FileNotFoundError_)
def handle_exception(error):
return render_template("error.html", error_msg=str(error)), 422

Expand Down