-
Notifications
You must be signed in to change notification settings - Fork 19
Nicer, more detailed error messages #10
Comments
I stumbled across the following while trying to fix my corrupted .glyphs file (googlefonts/glyphsLib#282):
At first I thought this was about the bold master, an edit to the error message to include the UFO path revealed it was about the regular master. Given that ufoLib is used by other libs, a much more detailed error object of some sort would be appreciated. |
I had the same problem. It is because I copied some glyphs from another font with more masters and the extra layers got preserved. It is not just layers without names, but also others which should not be there. This Glyphs.app script helps to clean things up.
|
(Yeah, that was the problem. I used the "Delete all non-master layers" script by mekkablue to kill and destroy everything.) |
I agree, we need to break up the two overly generic UFOLibError and GlifLibError into more specific errors (subclasses), that also carry more rich data than just the error message string. |
I think one important thing is to except and reraise (i.e. chain exceptions) in more strategic positions, so you can infer from the traceback which glyph in which layer in which UFO is to blame. |
Now that ufoLib requires pyfilesystem2, since the latter in turn requires six, we could make use of py2.py3 compatible functions |
I'm thinking of GlifLibError specifically.
In trufont/trufont#155, there was an error:
ufoLib.glifLib.GlifLibError: line can not have an offcurve.
Right now we display message with code like this:
which displays:
So here, the message could be capitalized, and include an information about the offending glyph etc. Maybe the offending glyph (and any other accessible parameter like the file name and line where the error occurs) could be stored as an attribute of the GlifLibError object such that caller can format it however they want.
Edit: regarding capitalization, maybe str.title() is in-order an on the command-line the title and content are on a single sentence.
The text was updated successfully, but these errors were encountered: