From ea366d9f8b14b5dc2120a19302fe794e4a6c0081 Mon Sep 17 00:00:00 2001 From: Peter Stockings Date: Sun, 24 Mar 2024 22:28:58 +1100 Subject: [PATCH] Add error page for http functions --- app.py | 3 + templates/function_error.html | 147 ++++++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+) create mode 100644 templates/function_error.html diff --git a/app.py b/app.py index e38c477..b4bbd5e 100644 --- a/app.py +++ b/app.py @@ -313,6 +313,9 @@ def execute_http_function(user_id, function): request_data if log_request else {}, response_data['result'] if (log_response or response_data['status'] != 'SUCCESS') else {}, response_data['logs']) + + if response_data['status'] != 'SUCCESS': + return render_template("function_error.html", function_name=function_name ,error=response_data['result'], logs=response_data['logs']) # Map the Node.js response to Flask response flask_response = map_isolator_response_to_flask_response(response_data) diff --git a/templates/function_error.html b/templates/function_error.html new file mode 100644 index 0000000..0afee44 --- /dev/null +++ b/templates/function_error.html @@ -0,0 +1,147 @@ +{% extends 'base.html' %} + +{% block content %} + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

500

+

Server Error

+

Whoops, something went wrong with {{function_name}}.

+ +
+
+
+
+ + + + Logs ({{ logs | count }}) +
+
+ + + + + + Error +
+
+ +
+
+
{{ + error }} +
+ +
+
+
+
+ +{% endblock %} \ No newline at end of file