epubcheck icon indicating copy to clipboard operation
epubcheck copied to clipboard

RSC-001 cryptic error message

Open mattgarrish opened this issue 10 years ago • 2 comments

This is the kind of message generated if a manifest entry references a missing file or the file path is wrong:

ERROR(RSC-001): .\figure-gallery-bindings.epub/figure-gallery-bindings.epub(-1,-1): File 'EPUB/epub.css' is not found.

This is too cryptic for the average user - it doesn't tell you where or why it was not found. It would be helpful to add more context to the message, along the lines of:

Manifest item references non-existent resource 'EPUB/epub.css'.

mattgarrish avatar Mar 09 '15 01:03 mattgarrish

I agree that this is not optimal, but I think it is actually a little worse. I have a tool (built in Eclipse which uses epubcheck for validation). In this case, if the manifest has a reference to a missing resource it calls back with the message that the resource couldn’t be found. Fine, but it reports the name of the missing resource but not the file (the actual OPF) which contains the missing reference. So my tool has no idea what file to point to let the user investigate and fix the problem. All I can do is tell the user there’s a problem somewhere in the project.

Seems like there are two problems. First it should report both what the missing resource is (which it does) AND what file (e.g. package.opf) the referenced the missing resource. In fact the it seems like it should be the OPF file that be passed as the MessageLocation, along with the line number where the invalid resource was found. Instead it passed the name of the EPUB file itself and the line and column number of -1. Unfortunately it isn't quite that easy as the calling routine validate() in EpubCfiCheck doesn't know the line number of the manifest, only its position in the zipfile.

The second part is that there is no (as far as I can see) and appropriate error message for this, along the lines of

 "Manifest item '%1$s' referenced in the OPF file ('%2$s') appears to be missing" 

rkwright avatar Mar 12 '15 15:03 rkwright

Since RSC-001 is thrown from different validation methods in different contexts, there are occasions in which the message is just fine:

ERROR(RSC-001): empty_dir.epub(-1,-1): File 'META-INF/container.xml' could not be found.

or

ERROR(RSC-001): empty_dir.epub/OPS/internal_dtd.xhtml(-1,-1): File 'sample.dtd' could not be found.

and others which are hard to understand like the message you mentioned:

ERROR(RSC-001): .\figure-gallery-bindings.epub/figure-gallery-bindings.epub(-1,-1): File 'EPUB/epub.css' is not found.

or for example:

ERROR(RSC-001): missing_toc_file.epub(-1,-1): File 'OPS/toc.xhtml' could not be found.

And I agree with you, that those should clearly have the OPF file as context item. But a solution like "Manifest item '%1$s' referenced in the OPF file ('%2$s') appears to be missing" from @rkwright is not always applicable.

Anyways, there's another problem with the current implementation of those messages: They are not thrown when parsing the OPF file, or the XHTML file with a context available, but instead they are thrown in XMLParser, NavChecker, BitmapChecker, GenericContentChecker, etc. classes which just don't know who called them. Let's take a CSS file as an example: When the RSC-001 message for a missing CSS file is thrown, we can't tell whether the context is a <link> element from an XHTML file or an OPF entry or both.

Nothing we can do about it at the moment, I'm sorry... :-(

tofi86 avatar Jan 02 '17 18:01 tofi86