From 2bf3bc4d3a9ae9732202664b58c8518fbae303f3 Mon Sep 17 00:00:00 2001 From: zefie Date: Sun, 2 Oct 2022 02:09:35 -0400 Subject: [PATCH] enable exception stack trace on PC pages (think PHP show_errors), with option to disable it globally --- zefie_wtvp_minisrv/app.js | 7 ++++++- zefie_wtvp_minisrv/config.json | 3 ++- zefie_wtvp_minisrv/zefie_wtvp_minisrv.njsproj | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/zefie_wtvp_minisrv/app.js b/zefie_wtvp_minisrv/app.js index 73e3c555..b41f6101 100644 --- a/zefie_wtvp_minisrv/app.js +++ b/zefie_wtvp_minisrv/app.js @@ -136,6 +136,7 @@ async function processPath(socket, service_vault_file_path, request_headers = ne http: http, https: https, wtvshared: wtvshared, + zlib: zlib, clientShowAlert: clientShowAlert, WTVClientSessionData: WTVClientSessionData, WTVClientCapabilities: WTVClientCapabilities, @@ -408,7 +409,11 @@ async function processPath(socket, service_vault_file_path, request_headers = ne } catch (e) { var errpage = wtvshared.doErrorPage(400); headers = errpage[0]; - data = errpage[1] + "

The interpreter said:
" + e.toString() + "
"; + data = errpage[1]; + if (socket.minisrv_pc_mode) { + if (minisrv_config.services.pc_services.show_verbose_errors) + data += "

The interpreter said:
" + e.stack + "
"; + } console.error(" * Scripting error:", e); } if (!request_is_async) { diff --git a/zefie_wtvp_minisrv/config.json b/zefie_wtvp_minisrv/config.json index 9cfd4742..2de886a1 100644 --- a/zefie_wtvp_minisrv/config.json +++ b/zefie_wtvp_minisrv/config.json @@ -131,9 +131,10 @@ }, "pc_services": { "port": 1699, - "servicevault_dir": "http_pc", "disabled": true, + "servicevault_dir": "http_pc", "drop_connection_on_wrong_port": false, + "show_verbose_errors": false, "allow_https": false, "force_https": false } diff --git a/zefie_wtvp_minisrv/zefie_wtvp_minisrv.njsproj b/zefie_wtvp_minisrv/zefie_wtvp_minisrv.njsproj index 68a91854..9147fff2 100644 --- a/zefie_wtvp_minisrv/zefie_wtvp_minisrv.njsproj +++ b/zefie_wtvp_minisrv/zefie_wtvp_minisrv.njsproj @@ -39,6 +39,8 @@ + + @@ -445,6 +447,8 @@ + +