Change many ERROR() calls into thrown exceptions

This requires a 508 beta version to use. If Travis fails this he's a bitch

Exceptions will generate a stack trace, which is way easier to see and more helpful in actually solving this kind of crap. Also logs all the arguments, src, line, and file automatically.
Removed any dubiously helpful information in the exception names so the runtime condenser won't see each one as a different runtime. If the information is critical to solve these bugs (camera one maybe?), then I'll just make these warnings.
Thrown exceptions crash the currently running proc. Yes that means there's useless returns in a bunch of these, sue me. spawn()'s are to let the proc continue.

Almost all of these are difficult to trigger, but I did test playsound. And frankly even if they do cause bugs by crashing procs, big whoop
This commit is contained in:
MrPerson
2015-07-23 06:46:40 -07:00
parent 81145ea134
commit 471d69fcf7
22 changed files with 56 additions and 44 deletions
+5 -3
View File
@@ -10,8 +10,10 @@ var/list/admin_ranks = list() //list of all admin_rank datums
name = init_name
switch(name)
if("Removed",null,"")
ERROR("invalid admin-rank name. datum deleted")
del(src)
spawn(-1)
del(src)
throw EXCEPTION("invalid admin-rank name")
return
if(init_rights) rights = init_rights
if(!init_adds) init_adds = list()
if(!init_subs) init_subs = list()
@@ -178,7 +180,7 @@ var/list/admin_ranks = list() //list of all admin_rank datums
var/ckey = ckey(query.item[1])
var/rank = ckeyEx(query.item[2])
if(rank_names[rank] == null)
error("Admin rank ([rank]) does not exist.")
WARNING("Admin rank ([rank]) does not exist.")
continue
var/datum/admins/D = new(rank_names[rank], ckey) //create the admin datum and store it for later use
if(!D) continue //will occur if an invalid rank is provided
+1 -1
View File
@@ -582,8 +582,8 @@ var/list/admin_verbs_hideable = list(
var/error_extra = ""
if(!config.admin_legacy_system)
error_extra = " Check mysql DB connection."
error("Error while re-adminning [src], admin rank ([rank]) does not exist.[error_extra]")
src << "Error while re-adminning, admin rank ([rank]) does not exist.[error_extra]"
WARNING("Error while re-adminning [src], admin rank ([rank]) does not exist.[error_extra]")
return
D = new(rank_names[rank],ckey)
var/client/C = directory[ckey]
+6 -4
View File
@@ -16,12 +16,14 @@ var/list/admin_datums = list()
/datum/admins/New(datum/admin_rank/R, ckey)
if(!ckey)
ERROR("Admin datum created without a ckey argument. Datum has been deleted")
del(src)
spawn(-1)
del(src)
throw EXCEPTION("Admin datum created without a ckey")
return
if(!istype(R))
ERROR("Admin datum created without a rank. Datum has been deleted")
del(src)
spawn(-1)
del(src)
throw EXCEPTION("Admin datum created without a rank")
return
rank = R
admincaster_signature = "Nanotrasen Officer #[rand(0,9)][rand(0,9)][rand(0,9)]"