HebiRobotics / hebi-matlab-api

Public download and issue tracker of the latest HEBI API for MATLAB
http://docs.hebi.us/tools.html#matlab-api
0 stars 0 forks source link

Better error messages when parsing HRDF #35

Closed daverolli closed 3 years ago

daverolli commented 4 years ago

Right the error messages when there's a typo in an HRDF aren't very useful. You usually just get: input file is not a valid hrdf file: null.

Any sort of hit as to even what line the parsing failed would help a ton.

ennerf commented 4 years ago

It seems there was a required attribute that didn't get validated (case 4). I've added a generic validation scheme so that won't happen in the future. The various error cases are currently (next snapshot) implemented as below. Let me know if you think I forgot anything.

unknown element (e.g. link2)

current: unexpected element (uri:"", local:"link2"). Expected elements are <{}actuator>,<{}joint>,<{}overrideableElement>,<{}end-effector>,<{}bracket>,<{}link>,<{}rigid-body>

changed to: Invalid content was found starting with element 'actuator2'. One of '{actuator, link, bracket, end-effector, rigid-body, joint}' is expected.

unknown attribute (e.g. <link ... unknown_attribute="3"/>

current: silently ignored

changed to: lineNumber: 2; columnNumber: 42; cvc-complex-type.3.2.2: Attribute 'unknown_attribute' is not allowed to appear in element 'link'.'

bad attribute value (e.g. type="X5-3" or extension="pretty long")

missing required attribute (e.g. type2="X5")

current: NullPointerException

changed to: lineNumber: 2; columnNumber: 34; cvc-complex-type.4: Attribute 'type' must appear on element 'link'.

missing xml (end) tags (e.g. <link type="X5-1")

lineNumber: 3; columnNumber: 3; The element type "link" must be terminated by the matching end-tag "</link>