[ https://issues.apache.org/jira/browse/DAFFODIL-752?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Josh Adams reassigned DAFFODIL-752: ----------------------------------- Assignee: Josh Adams > Assertion failure message should show value that led to failure. > ---------------------------------------------------------------- > > Key: DAFFODIL-752 > URL: https://issues.apache.org/jira/browse/DAFFODIL-752 > Project: Daffodil > Issue Type: Improvement > Components: Back End > Affects Versions: s10 > Reporter: Michael Beckerle > Assignee: Josh Adams > Priority: Major > Fix For: s11-M1, s11 > > Time Spent: 20m > > We need to show the infoset element as part of the assertion failure message, > specifically for an assertion on an element of simple type. > (For an assert on a complex type element, or a sequence or choice, it's > trickier. There I think we could show the infoset object, but as in many > places where we need to show this, we need to be able to elide unnecessary > substructure or parent structure. Otherwise these will get big and unweildy. > - separate JIRA issue should we decide to go there.) > ------------------------------------- > From: Garriss Jr., James P. [jgarr...@mitre.org] > Sent: Friday, June 07, 2013 10:23 AM > To: Mike Beckerle; Stephen Lawrence > Subject: [daffodil 0.10] Error message improvement suggestion > I have this simple input: > > MIME-Version: dog > > Obviously invalid. I���m describing it with this schema: > > <xsd:element name="MimeVersion" > dfdl:initiator="MIME-Version:%SP;" dfdl:terminator="%NL;" dfdl:length="3" > dfdl:lengthKind="explicit"> > <xsd:annotation> > <xsd:appinfo > source="http://www.ogf.org/dfdl/dfdl-1.0/"> > <dfdl:assert test="{ > dfdl:checkConstraints(.) }" message="MIME-Version must have a value of > '1.0'."/> > </xsd:appinfo> > </xsd:annotation> > <xsd:simpleType> > <xsd:restriction base="xsd:string"> > <xsd:enumeration value="1.0"/> > </xsd:restriction> > </xsd:simpleType> > </xsd:element> > > The error message I get is: > > [error] Parse Error: Assertion failed. MIME-Version must have a value of > '1.0'. > Schema context: element.MimeVersion Location line 13 column 135 in > file:/C:/���/MimeVersion.xsd > Data location was preceding byte 19 > UTF-8 text starting at byte 16 is: (g > ) > Data (hex) starting at byte 16 is: (0x670D0A) > > Getting my assertion message back is helpful, as it tells me what the right > value should be. But I think this error could be improved by also telling me > what value was found. Perhaps the message could look at bit more like this: > > [parsing error] While processing the MimeVersion element, the value ���dog��� > was found. > This fails the assertion: MIME-Version must have a value of '1.0'. > Schema: Location line 13 column 135 in file:/C:/���/MimeVersion.xsd -- This message was sent by Atlassian JIRA (v7.6.3#76005)