Files
transcience/addons/gut/gut_tracked_error.gd
claude c4beeae38f Initial commit: Transcience MVP
Top-down twin-stick bullet-hell, Godot 4.7, server-authoritative dedicated
server with client-side prediction. Clients send input only; the server
resolves every hit for both players and enemies (no PvP).

- SimWorld: whole simulation as plain RefCounted objects (no nodes, no
  physics server), ~0.24ms/tick at peak load -- runs headless for free and
  drives 78 tests in under a second
- BulletPool: struct-of-arrays bullet storage, replicated as spawn/despawn
  events rather than per-tick state
- Emitter framework (Ring/AimedSpread/WallGap/ArcSweep) shared by trash
  enemies and bosses -- a new boss is data in src/content/content.gd, no
  simulation changes
- The Warden of the Fold: stationary 4-phase boss built entirely on that
  format
- Lobby hub with a portal into on-demand dungeon instances; one process
  hosts the hub plus every concurrent dungeon
- Emergency escape: 3s server-owned channel, cancelled by damage
- tools/check.sh, test.sh (GUT), smoke.sh (real server + bot clients over
  ENet), bench.gd; git hooks wired to the same scripts
- docs/ARCHITECTURE.md, NETCODE.md, WORKFLOW.md, ROADMAP.md
2026-09-03 16:03:57 +02:00

95 lines
3.3 KiB
GDScript

class_name GutTrackedError
## This contains all the information provided by Godot about an error.
## This is also used to represent a GUT error. See [Logger] for
## additional information about properties. Some properties are not populated
## for GUT errors.
## This will be an [code]Array[ScriptBacktrace][/code] for engine/push errors.
## This will the result of [code]get_stack[/code] for GUT errors.
var backtrace = []
## Usually the description
var code = GutUtils.NO_TEST
var rationale = GutUtils.NO_TEST
## [enum Logger.ErrorType] value or, for GUT errors, this will be [code skip-lint]GutUtils.GUT_ERROR_TYPE[/code].
var error_type = -1
var editor_notify = false
## The full path to the file where the error occurred.
var file = GutUtils.NO_TEST
## The function name in [member file] where the error occurred.
var function = GutUtils.NO_TEST
## The line number in [member file]
var line = -1
## Used by GUT to flag errors as being handled. This is set by various asserts
## or can be set in a test. When set to [code]true[/code] GUT will ignore it
## when determining if an unexpected error occurred during the execution of the
## test. Setting this value prior to performing any of the error related
## asserts may have unexpected results. It is recommended you either set this
## manually or use the error asserts.
var handled = false
## _to_string that is not _to_string.
func to_s() -> String:
return str("CODE:", code, "\nTYPE:", error_type, "\nRATIONALE:", rationale, "\n",
file, '->', function, '@', line, "\n",
"handled: ", handled, "\n",
"gut type: ", get_error_type_name(),"\n",
"error_type: ", error_type, "\n",
"editor_notify:", editor_notify, "\n",
backtrace, "\n")
## Returns [code]true[/code] if the error is a push_error.
func is_push_error():
return error_type != GutUtils.GUT_ERROR_TYPE and function == &"push_error"
## Returns [code]true[/code] if the error is an engine error. This includes
## all errors that pass through the [Logger] that do not originate from the
## [code]push_error[/code] function.
func is_engine_error():
return error_type >= 0 and error_type != GutUtils.GUT_ERROR_TYPE and !is_push_error() and !is_push_warning()
func is_push_warning():
return function == &"push_warning"
## Returns [code]true[/code] if the error is a GUT error. Some fields may not
## be populated for GUT errors.
func is_gut_error():
return error_type == GutUtils.GUT_ERROR_TYPE
func contains_text(text):
return code.to_lower().find(text.to_lower()) != -1 or \
rationale.to_lower().find(text.to_lower()) != -1
## For display purposes only, the actual value returned may change over time.
## This returns a name for the error_type as far as this class is concerned.
## Use the various [code]is_[/code] methods to check if an error is a certain
## type.
func get_error_type_name():
var to_return = "Unknown"
if(is_gut_error()):
to_return = &"GUT"
elif(is_push_error()):
to_return = &"push_error"
elif(is_push_warning()):
to_return = &'push_warning'
elif(is_engine_error()):
to_return = str("engine-", error_type)
return to_return
# this might not work in other languages, and feels falkey, but might be
# useful at some point.
# func is_assert():
# return error_type == Logger.ERROR_TYPE_SCRIPT and \
# (code.find("Assertion failed.") == 0 or \
# code.find("Assertion failed:") == 0)