better error message for duplicated ids in conf.xml

This commit is contained in:
Pascal Brisset
2008-06-29 20:08:09 +00:00
parent 2346caa13f
commit 65279e62ad
+7 -4
View File
@@ -40,10 +40,13 @@ let check_unique_id = fun conf ->
List.iter
(fun x ->
if String.lowercase (Xml.tag x) = "aircraft" then
let id = ExtXml.attrib x "ac_id" in
if Hashtbl.mem ids id then
failwith (sprintf "Error: A/C Id '%s' duplicated in %s" id conf_xml);
Hashtbl.add ids id ())
let id = ExtXml.attrib x "ac_id"
and name = ExtXml.attrib x "name" in
if Hashtbl.mem ids id then begin
let other_name = Hashtbl.find ids id in
failwith (sprintf "Error: A/C Id '%s' duplicated in %s (%s and %s)" id conf_xml name other_name)
end;
Hashtbl.add ids id name)
(Xml.children conf)
let _ =