Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T5385: catch correct errors in Xml_light Xml.parse_file #18

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/reference_tree.ml
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,17 @@ let load_from_xml reftree file =
match xml with
| Xml.Element ("interfaceDefinition", _, children) ->
List.fold_left (insert_from_xml []) reftree children
| _ -> raise (Bad_interface_definition "Should start with <interfaceDefinition>")
| _ -> raise (Bad_interface_definition "File should begin with <interfaceDefinition>")
in
try
let xml = Xml.parse_file file in
xml_to_reftree xml reftree
with
| Xml.File_not_found msg -> raise (Bad_interface_definition msg)
| Xml.Error e -> raise (Bad_interface_definition (Xml.error e))
| Xml_light_errors.File_not_found msg -> raise (Bad_interface_definition msg)
| Xml_light_errors.Xml_error err ->
let (msg, pos) = err in
let s = Printf.sprintf ": line %d in file %s" pos.eline file in
raise (Bad_interface_definition ((Xml.error_msg msg)^s))

let is_multi reftree path =
let data = Vytree.get_data reftree path in
Expand Down