Minimal runtime viewer for non-admins

This commit is contained in:
Belaya
2025-08-08 13:31:06 -05:00
parent e59be5e480
commit 7418a41520
2 changed files with 24 additions and 2 deletions
+16 -2
View File
@@ -23,6 +23,7 @@ GLOBAL_DATUM(error_cache, /datum/error_viewer/error_cache)
// Common vars and procs are kept at the error_viewer level
/datum/error_viewer
var/name = ""
var/min_name = "" //GS13: Runtime viewer for users
/datum/error_viewer/proc/browse_to(client/user, html)
var/datum/browser/browser = new(user.mob, "error_viewer", null, 600, 400)
@@ -78,6 +79,15 @@ GLOBAL_DATUM(error_cache, /datum/error_viewer/error_cache)
var/list/error_sources = list()
var/list/errors_silenced = list()
/datum/error_viewer/error_cache/proc/show_to_minimal(user, datum/error_viewer/back_to, linear)
var/html = "<b>[GLOB.total_runtimes]</b> runtimes, <b>[GLOB.total_runtimes_skipped]</b> skipped<br><br>"
var/datum/error_viewer/error_source/error_source
for (var/erroruid in error_sources)
error_source = error_sources[erroruid]
html += "[error_source.min_name]<br>"
browse_to(user, html)
/datum/error_viewer/error_cache/show_to(user, datum/error_viewer/back_to, linear)
var/html = build_header()
html += "<b>[GLOB.total_runtimes]</b> runtimes, <b>[GLOB.total_runtimes_skipped]</b> skipped<br><br>"
@@ -134,7 +144,9 @@ GLOBAL_DATUM(error_cache, /datum/error_viewer/error_cache)
name = "\[[TIME_STAMP("hh:mm:ss", FALSE)]] Uncaught exceptions"
return
name = "<b>\[[TIME_STAMP("hh:mm:ss", FALSE)]]</b> Runtime in <b>[e.file]</b>, line <b>[e.line]</b>: <b>[html_encode(e.name)]</b>"
//GS13: Runtime viewer for users
min_name = "<b>\[[TIME_STAMP("hh:mm:ss", FALSE)]]</b> Runtime in <b>[e.file]</b>, line <b>[e.line]</b>"
name = min_name + ": <b>[html_encode(e.name)]</b>"
/datum/error_viewer/error_source/show_to(user, datum/error_viewer/back_to, linear)
if (!istype(back_to))
@@ -164,7 +176,9 @@ GLOBAL_DATUM(error_cache, /datum/error_viewer/error_cache)
is_skip_count = TRUE
return
name = "<b>\[[TIME_STAMP("hh:mm:ss", FALSE)]]</b> Runtime in <b>[e.file]</b>, line <b>[e.line]</b>: <b>[html_encode(e.name)]</b>"
//GS13: Runtime viewer for users
min_name = "<b>\[[TIME_STAMP("hh:mm:ss", FALSE)]]</b> Runtime in <b>[e.file]</b>, line <b>[e.line]</b>"
name = min_name + ": <b>[html_encode(e.name)]</b>"
exc = e
if (istype(desclines))
for (var/line in desclines)