Closed ndw closed 4 years ago
Suppose it can't be parsed. If it can't, then the attempt to parse it must have raised an exception (e.g, err:XD0049). But p:uncompress is required to raise err:XC0201 in this case. That means I'm going to mask the underlying exception.
The "masking" seems to be a result of your implementation strategy. In my implementation the parser doesnt generate XProc errrors (like XD0049), but throws eg. a SAXException. My implementation has to catch this and throw XC0201.
In general I would prefer to keep XC0201 because the casting error might not necessarily come from XML parsing. Suppose the uncompressed document claims to be "image/jpeg" and my implementation tests this claim. Currently XC0201 is the error to raise. No other error will fit.
Ok. I don't feel strongly about it. Anyone else have an opinion?
I’m with Achim on this one
Okay.
Suppose I uncompress some data. If the resulting stream can be parsed as its content type, good, we're done.
Suppose it can't be parsed. If it can't, then the attempt to parse it must have raised an exception (e.g,
err:XD0049
). Butp:uncompress
is required to raiseerr:XC0201
in this case. That means I'm going to mask the underlying exception.Pro: the exception you have to catch from
p:uncompess
is alwayserr:XC0201
. Con: catching that exception doesn't tell you anything about what actually failed.What do folks think?