Merge pull request #12605 from Citadel-Station-13/silicons-patch-4

adds line numbers to config errors
This commit is contained in:
Lin
2020-06-29 13:12:25 -05:00
committed by GitHub

View File

@@ -104,7 +104,9 @@
var/list/lines = world.file2list("[directory]/[filename]")
var/list/_entries = entries
var/list/postload_required = list()
var/linenumber = 0
for(var/L in lines)
linenumber++
L = trim(L)
if(!L)
continue
@@ -132,7 +134,7 @@
if(entry == "$include")
if(!value)
log_config("Warning: Invalid $include directive: [value]")
log_config("LINE [linenumber]: Invalid $include directive: [value]")
else
LoadEntries(value, stack)
++.
@@ -140,7 +142,7 @@
var/datum/config_entry/E = _entries[entry]
if(!E)
log_config("Unknown setting in configuration: '[entry]'")
log_config("LINE [linenumber]: Unknown setting: '[entry]'")
continue
if(lockthis)
@@ -150,7 +152,7 @@
var/datum/config_entry/new_ver = entries_by_type[E.deprecated_by]
var/new_value = E.DeprecationUpdate(value)
var/good_update = istext(new_value)
log_config("Entry [entry] is deprecated and will be removed soon. Migrate to [new_ver.name]![good_update ? " Suggested new value is: [new_value]" : ""]")
log_config("LINE [linenumber]: [entry] is deprecated and will be removed soon. Migrate to [new_ver.name]![good_update ? " Suggested new value is: [new_value]" : ""]")
if(!warned_deprecated_configs)
addtimer(CALLBACK(GLOBAL_PROC, /proc/message_admins, "This server is using deprecated configuration settings. Please check the logs and update accordingly."), 0)
warned_deprecated_configs = TRUE
@@ -162,10 +164,10 @@
var/validated = E.ValidateAndSet(value, TRUE)
if(!validated)
log_config("Failed to validate setting \"[value]\" for [entry]")
log_config("LINE [linenumber]: Failed to validate setting \"[value]\" for [entry]")
else
if(E.modified && !E.dupes_allowed)
log_config("Duplicate setting for [entry] ([value], [E.resident_file]) detected! Using latest.")
log_config("LINE [linenumber]: Duplicate setting for [entry] ([value], [E.resident_file]) detected! Using latest.")
if(E.postload_required)
postload_required[E] = TRUE