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

Is err:XC0201 really helpful on p:uncompress? #289

Closed
ndw opened this issue Dec 14, 2019 · 4 comments
Closed

Is err:XC0201 really helpful on p:uncompress? #289

ndw opened this issue Dec 14, 2019 · 4 comments

Comments

@ndw
Copy link
Collaborator

@ndw ndw commented Dec 14, 2019

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). But p:uncompress is required to raise err: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 always err:XC0201.
Con: catching that exception doesn't tell you anything about what actually failed.

What do folks think?

@xml-project

This comment has been minimized.

Copy link
Contributor

@xml-project xml-project commented Dec 14, 2019

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.

@ndw

This comment has been minimized.

Copy link
Collaborator Author

@ndw ndw commented Dec 14, 2019

Ok. I don't feel strongly about it. Anyone else have an opinion?

@gimsieke

This comment has been minimized.

Copy link
Contributor

@gimsieke gimsieke commented Dec 15, 2019

I’m with Achim on this one

@ndw

This comment has been minimized.

Copy link
Collaborator Author

@ndw ndw commented Dec 15, 2019

Okay.

@ndw ndw closed this Dec 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.