Skip to content

Commit

Permalink
added session catch
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasmllr committed Dec 6, 2024
1 parent 12487ae commit eeb502d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions frontend/rctool/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,12 @@ def rctool_develop_initialize(request):
import_form = import_rc_data(request.POST, request.FILES)
session_content = request.POST.get("session_content")

df = pd.read_json(io.StringIO(session_content))
try:
df = pd.read_json(io.StringIO(session_content))
except Exception as e:
messages.error(request, "Error: session file could not be parsed.")
return render(request, "rctool/rctool/import/rctool_import.html", context)


# preprocess data from previous session
data_raw_lst = df["data"].values.tolist()
Expand Down Expand Up @@ -428,7 +433,7 @@ def rctool_develop_initialize(request):
try:
field_df_raw = pd.read_json(io.StringIO(field_data_json))
except Exception as e:
messages.error(request, "Error: CSV file is could not be parsed.")
messages.error(request, "Error: CSV file could not be parsed.")
return render(request, "rctool/rctool/import/rctool_import.html", context)

# convert first row to lower case
Expand Down

0 comments on commit eeb502d

Please sign in to comment.