[WIP] Refactoring - Uniform error message + TOML exception catch

This commit is contained in:
slawkens
2026-03-01 21:45:48 +01:00
parent 4ca79a1e85
commit fbb5034458
12 changed files with 92 additions and 38 deletions

View File

@@ -16,8 +16,12 @@ class Outfits
return;
}
$xml = new \DOMDocument;
$xml->load($file);
$xml = new \DOMDocument();
if(!$xml->load($file)) {
error('Error: Cannot load outfits.xml. More info in system/logs/error.log file.');
log_append('error.log', "[" . __CLASS__ . "] Fatal error: Cannot load outfits.xml - $file. Error: " . print_r(error_get_last(), true));
return;
}
foreach ($xml->getElementsByTagName('outfit') as $outfit) {
$this->outfits[] = $this->parseOutfitNode($outfit);
@@ -43,7 +47,7 @@ class Outfits
];
}
public function getOutfits(): array {
public function get(): array {
return $this->outfits;
}
}