From bb7bfc04cccefe38672ef27740462f782a30d9e8 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Thu, 5 Mar 2020 01:47:04 +0100 Subject: [PATCH] Replaces EXCEPTION() with stack_trace() and CRASH() --- code/controllers/subsystem.dm | 2 +- code/controllers/subsystem/jukeboxes.dm | 6 +++--- code/controllers/subsystem/shuttle.dm | 5 ++--- code/datums/progressbar.dm | 2 +- code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm | 2 +- code/game/sound.dm | 3 +-- code/modules/admin/admin_ranks.dm | 3 +-- code/modules/admin/holder2.dm | 6 ++---- code/modules/antagonists/blob/blob/theblob.dm | 3 +-- code/modules/antagonists/changeling/cellular_emporium.dm | 2 +- code/modules/antagonists/devil/devil.dm | 2 +- .../atmospherics/machinery/components/components_base.dm | 2 +- code/modules/mining/equipment/survival_pod.dm | 2 +- code/modules/newscaster/newscaster_machine.dm | 3 +-- code/modules/ninja/ninja_event.dm | 2 +- code/modules/power/apc.dm | 3 +-- code/modules/vore/persistence.dm | 6 +++--- modular_citadel/code/modules/mentor/mentor.dm | 3 +-- 18 files changed, 24 insertions(+), 33 deletions(-) diff --git a/code/controllers/subsystem.dm b/code/controllers/subsystem.dm index 3be4f36270..a16de2ba4c 100644 --- a/code/controllers/subsystem.dm +++ b/code/controllers/subsystem.dm @@ -63,7 +63,7 @@ //Sleeping in here prevents future fires until returned. /datum/controller/subsystem/proc/fire(resumed = 0) flags |= SS_NO_FIRE - throw EXCEPTION("Subsystem [src]([type]) does not fire() but did not set the SS_NO_FIRE flag. Please add the SS_NO_FIRE flag to any subsystem that doesn't fire so it doesn't get added to the processing list and waste cpu.") + CRASH("Subsystem [src]([type]) does not fire() but did not set the SS_NO_FIRE flag. Please add the SS_NO_FIRE flag to any subsystem that doesn't fire so it doesn't get added to the processing list and waste cpu.") /datum/controller/subsystem/Destroy() dequeue() diff --git a/code/controllers/subsystem/jukeboxes.dm b/code/controllers/subsystem/jukeboxes.dm index 1532a3f41a..2b227e9cab 100644 --- a/code/controllers/subsystem/jukeboxes.dm +++ b/code/controllers/subsystem/jukeboxes.dm @@ -83,15 +83,15 @@ SUBSYSTEM_DEF(jukeboxes) return for(var/list/jukeinfo in activejukeboxes) if(!jukeinfo.len) - EXCEPTION("Active jukebox without any associated metadata.") + stack_trace("Active jukebox without any associated metadata.") continue var/datum/track/juketrack = jukeinfo[1] if(!istype(juketrack)) - EXCEPTION("Invalid jukebox track datum.") + stack_trace("Invalid jukebox track datum.") continue var/obj/jukebox = jukeinfo[3] if(!istype(jukebox)) - EXCEPTION("Nonexistant or invalid object associated with jukebox.") + stack_trace("Nonexistant or invalid object associated with jukebox.") continue var/sound/song_played = sound(juketrack.song_path) var/area/currentarea = get_area(jukebox) diff --git a/code/controllers/subsystem/shuttle.dm b/code/controllers/subsystem/shuttle.dm index bcbe2bb49b..ec3b292981 100644 --- a/code/controllers/subsystem/shuttle.dm +++ b/code/controllers/subsystem/shuttle.dm @@ -185,14 +185,13 @@ SUBSYSTEM_DEF(shuttle) WARNING("requestEvac(): There is no emergency shuttle, but the \ shuttle was called. Using the backup shuttle instead.") if(!backup_shuttle) - throw EXCEPTION("requestEvac(): There is no emergency shuttle, \ + CRASH("requestEvac(): There is no emergency shuttle, \ or backup shuttle! The game will be unresolvable. This is \ possibly a mapping error, more likely a bug with the shuttle \ manipulation system, or badminry. It is possible to manually \ resolve this problem by loading an emergency shuttle template \ manually, and then calling register() on the mobile docking port. \ Good luck.") - return emergency = backup_shuttle var/srd = CONFIG_GET(number/shuttle_refuel_delay) if(world.time - SSticker.round_start_time < srd) @@ -420,7 +419,7 @@ SUBSYSTEM_DEF(shuttle) /datum/controller/subsystem/shuttle/proc/request_transit_dock(obj/docking_port/mobile/M) if(!istype(M)) - throw EXCEPTION("[M] is not a mobile docking port") + CRASH("[M] is not a mobile docking port") if(M.assigned_transit) return diff --git a/code/datums/progressbar.dm b/code/datums/progressbar.dm index 3599c60f89..faecf809cc 100644 --- a/code/datums/progressbar.dm +++ b/code/datums/progressbar.dm @@ -11,7 +11,7 @@ /datum/progressbar/New(mob/User, goal_number, atom/target) . = ..() if (!istype(target)) - EXCEPTION("Invalid target given") + CRASH("Invalid target given") if (goal_number) goal = goal_number bar = image('icons/effects/progessbar.dmi', target, "prog_bar_0", HUD_LAYER) diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm index 7ad4cee884..6d1933c0fd 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm @@ -746,7 +746,7 @@ Mind.add_antag_datum(ninjadatum) if(Ninja.mind != Mind) //something has gone wrong! - throw EXCEPTION("Ninja created with incorrect mind") + stack_trace("Ninja created with incorrect mind") message_admins("[ADMIN_LOOKUPFLW(Ninja)] has been made into a ninja by dynamic.") log_game("[key_name(Ninja)] was spawned as a ninja by dynamic.") diff --git a/code/game/sound.dm b/code/game/sound.dm index 11e026109a..c285026d5b 100644 --- a/code/game/sound.dm +++ b/code/game/sound.dm @@ -1,7 +1,6 @@ /proc/playsound(atom/source, soundin, vol as num, vary, extrarange as num, falloff, frequency = null, channel = 0, pressure_affected = TRUE, ignore_walls = TRUE, soundenvwet = -10000, soundenvdry = 0) if(isarea(source)) - throw EXCEPTION("playsound(): source is an area") - return + CRASH("playsound(): source is an area") var/turf/turf_source = get_turf(source) diff --git a/code/modules/admin/admin_ranks.dm b/code/modules/admin/admin_ranks.dm index b5127929a7..ef4abeb0ad 100644 --- a/code/modules/admin/admin_ranks.dm +++ b/code/modules/admin/admin_ranks.dm @@ -23,8 +23,7 @@ GLOBAL_PROTECT(protected_ranks) name = init_name if(!name) qdel(src) - throw EXCEPTION("Admin rank created without name.") - return + CRASH("Admin rank created without name.") if(init_rights) rights = init_rights include_rights = rights diff --git a/code/modules/admin/holder2.dm b/code/modules/admin/holder2.dm index 37fe2a41fc..1d0b6b2a79 100644 --- a/code/modules/admin/holder2.dm +++ b/code/modules/admin/holder2.dm @@ -39,12 +39,10 @@ GLOBAL_PROTECT(href_token) return if(!ckey) QDEL_IN(src, 0) - throw EXCEPTION("Admin datum created without a ckey") - return + CRASH("Admin datum created without a ckey") if(!istype(R)) QDEL_IN(src, 0) - throw EXCEPTION("Admin datum created without a rank") - return + CRASH("Admin datum created without a rank") target = ckey name = "[ckey]'s admin datum ([R])" rank = R diff --git a/code/modules/antagonists/blob/blob/theblob.dm b/code/modules/antagonists/blob/blob/theblob.dm index 953b876b35..fc78f859f2 100644 --- a/code/modules/antagonists/blob/blob/theblob.dm +++ b/code/modules/antagonists/blob/blob/theblob.dm @@ -303,8 +303,7 @@ /obj/structure/blob/proc/change_to(type, controller) if(!ispath(type)) - throw EXCEPTION("change_to(): invalid type for blob") - return + CRASH("change_to(): invalid type for blob") var/obj/structure/blob/B = new type(src.loc, controller) B.creation_action() B.update_icon() diff --git a/code/modules/antagonists/changeling/cellular_emporium.dm b/code/modules/antagonists/changeling/cellular_emporium.dm index 3cf0a3ee25..b2c1a52a4a 100644 --- a/code/modules/antagonists/changeling/cellular_emporium.dm +++ b/code/modules/antagonists/changeling/cellular_emporium.dm @@ -81,7 +81,7 @@ if(istype(our_target, /datum/cellular_emporium)) cellular_emporium = our_target else - throw EXCEPTION("cellular_emporium action created with non emporium") + CRASH("cellular_emporium action created with non emporium") /datum/action/innate/cellular_emporium/Activate() cellular_emporium.ui_interact(owner) diff --git a/code/modules/antagonists/devil/devil.dm b/code/modules/antagonists/devil/devil.dm index 951fe4e18a..84920eba00 100644 --- a/code/modules/antagonists/devil/devil.dm +++ b/code/modules/antagonists/devil/devil.dm @@ -477,7 +477,7 @@ GLOBAL_LIST_INIT(devil_suffix, list(" the Red", " the Soulless", " the Master", if(SOULVALUE >= ARCH_THRESHOLD && ascendable) A.convert_to_archdevil() else - throw EXCEPTION("Unable to find a blobstart landmark for hellish resurrection") + CRASH("Unable to find a blobstart landmark for hellish resurrection") /datum/antagonist/devil/proc/update_hud() diff --git a/code/modules/atmospherics/machinery/components/components_base.dm b/code/modules/atmospherics/machinery/components/components_base.dm index 86e8863b2b..a79beca4ec 100644 --- a/code/modules/atmospherics/machinery/components/components_base.dm +++ b/code/modules/atmospherics/machinery/components/components_base.dm @@ -144,7 +144,7 @@ for(var/i in 1 to device_type) var/datum/pipeline/parent = parents[i] if(!parent) - throw EXCEPTION("Component is missing a pipenet! Rebuilding...") + stack_trace("Component is missing a pipenet! Rebuilding...") build_network() parent.update = 1 diff --git a/code/modules/mining/equipment/survival_pod.dm b/code/modules/mining/equipment/survival_pod.dm index 10b33cd473..68e70dc882 100644 --- a/code/modules/mining/equipment/survival_pod.dm +++ b/code/modules/mining/equipment/survival_pod.dm @@ -23,7 +23,7 @@ return template = SSmapping.shelter_templates[template_id] if(!template) - throw EXCEPTION("Shelter template ([template_id]) not found!") + stack_trace("Shelter template ([template_id]) not found!") qdel(src) /obj/item/survivalcapsule/Destroy() diff --git a/code/modules/newscaster/newscaster_machine.dm b/code/modules/newscaster/newscaster_machine.dm index 38230840ec..93d5dc3b31 100644 --- a/code/modules/newscaster/newscaster_machine.dm +++ b/code/modules/newscaster/newscaster_machine.dm @@ -657,8 +657,7 @@ GLOBAL_LIST_EMPTY(allCasters) var/mob/living/silicon/ai_user = user scanned_user = "[ai_user.name] ([ai_user.job])" else - throw EXCEPTION("Invalid user for this proc") - return + CRASH("Invalid user for this proc") /obj/machinery/newscaster/proc/print_paper() SSblackbox.record_feedback("amount", "newspapers_printed", 1) diff --git a/code/modules/ninja/ninja_event.dm b/code/modules/ninja/ninja_event.dm index f166717aaf..f1e7119530 100644 --- a/code/modules/ninja/ninja_event.dm +++ b/code/modules/ninja/ninja_event.dm @@ -69,7 +69,7 @@ Contents: Mind.add_antag_datum(ninjadatum) if(Ninja.mind != Mind) //something has gone wrong! - throw EXCEPTION("Ninja created with incorrect mind") + stack_trace("Ninja created with incorrect mind") spawned_mobs += Ninja message_admins("[ADMIN_LOOKUPFLW(Ninja)] has been made into a ninja by an event.") diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 43a1f94ca5..a53af534e1 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -570,8 +570,7 @@ else if (istype(W, /obj/item/stack/cable_coil) && opened) var/turf/host_turf = get_turf(src) if(!host_turf) - throw EXCEPTION("attackby on APC when it's not on a turf") - return + CRASH("attackby on APC when it's not on a turf") if (host_turf.intact) to_chat(user, "You must remove the floor plating in front of the APC first!") return diff --git a/code/modules/vore/persistence.dm b/code/modules/vore/persistence.dm index 078a3f48ee..f45a759fa3 100644 --- a/code/modules/vore/persistence.dm +++ b/code/modules/vore/persistence.dm @@ -78,12 +78,12 @@ in their list /proc/list_to_object(var/list/data, var/loc) if(!islist(data)) - throw EXCEPTION("You didn't give me a list, bucko") + stack_trace("You didn't give me a list, bucko") if(!("type" in data)) - throw EXCEPTION("No 'type' field in the data") + stack_trace("No 'type' field in the data") var/path = text2path(data["type"]) if(!path) - throw EXCEPTION("Path not found: [path]") + stack_trace("Path not found: [path]") var/atom/movable/thing = new path(loc) thing.deserialize(data) diff --git a/modular_citadel/code/modules/mentor/mentor.dm b/modular_citadel/code/modules/mentor/mentor.dm index 4446c41d96..79345e6478 100644 --- a/modular_citadel/code/modules/mentor/mentor.dm +++ b/modular_citadel/code/modules/mentor/mentor.dm @@ -14,8 +14,7 @@ GLOBAL_PROTECT(mentor_href_token) /datum/mentors/New(ckey) if(!ckey) QDEL_IN(src, 0) - throw EXCEPTION("Mentor datum created without a ckey") - return + CRASH("Mentor datum created without a ckey") target = ckey(ckey) name = "[ckey]'s mentor datum" href_token = GenerateToken()