stevedlawrence commented on code in PR #917:
URL: https://github.com/apache/daffodil/pull/917#discussion_r1073895317
##########
daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/TypeCalculator.scala:
##########
@@ -176,17 +176,17 @@ class KeysetValueTypeCalculatorUnordered(valueMap:
HashMap[DataValuePrimitive, D
if (valueMap.contains(x)) {
valueMap.get(x) match {
case Some(a) => (a, Maybe.Nope)
- case None => (DataValue.NoValue, One(s"Value ${x} not found in
keyset-value mapping"))
+ case None => (DataValue.NoValue, One(s"Value ${x} not found in
enumeration key-value mapping"))
}
} else {
- (DataValue.NoValue, One(s"Key ${x} not found in keyset-value mapping"))
+ (DataValue.NoValue, One(s"Key ${x} not found in enumeration key-value
mapping"))
}
}
override def outputTypeCalc(x: DataValuePrimitive, xType: NodeInfo.Kind):
(DataValuePrimitiveNullable, Maybe[Error]) = {
unparseMap.get(x) match {
case Some(v) => (v, Maybe.Nope)
- case None => (DataValue.NoValue, One(s"Value ${x} not found in
keyset-value mapping"))
+ case None => (DataValue.NoValue, One(s"Value ${x} not found in
enumeration key-value mapping"))
Review Comment:
I wonder if we can be a bit more precise and thus more helpful? My concern
is "key-value mapping" isn't a term a schema developer might know since none of
the properties use those terms.
I think when parsing we are looking for a value in `dfdlx:repValues`, and
when unparsing we are looking for a string in the enumeration `value`? Is it
worth differentiating and saying something like this when parsing:
> Value ${x} not found in enumeration dfdlx:repValues properties
And this for unparsing:
> Value ${x} not found in enumeration value properties
I'm not sure I like that wording a ton better, but I think mentioning
value/repValues might help to point the user at the right attribute that we are
looking for a match but didn't find?
##########
daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/TypeCalculator.scala:
##########
@@ -153,7 +153,7 @@ class KeysetValueTypeCalculatorOrdered(valueMap:
HashMap[DataValuePrimitive, Dat
})
ans1 match {
case None => {
- (DataValue.NoValue, One(s"Key ${x} not found in keyset-value
mapping"))
+ (DataValue.NoValue, One(s"Key ${x} not found in enumeration
key-value mapping"))
Review Comment:
I guess we were missing this coverage in the past, but it might be nice to
add additional tests to improve coverage of all these different error
conditions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]