-
Notifications
You must be signed in to change notification settings - Fork 119
stl: improve error messages #128
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
base: master
Are you sure you want to change the base?
Conversation
|
Adding the field targeted by the error is a good idea, however I'd rather keep the |
|
Indeed, before submitting this PR, I checked that the |
|
I added a change to ignore the Atoi errors when parsing TND and DSN: we encounter some STL with binary "1" instead of ASCII "1", and those values have no interests when convertings subs anyways (plus ttconv also ignores them). |
7a9ce06 to
083c8fc
Compare
|
Like my previous change, ignore errors in Revision Number, which has no value when converting STL to another format. |
I'd rather keep prefixing all errors with the package emitting the error. |
I'm wondering whether we should ignore all errors in // Creation date
if v := strings.TrimSpace(string(b[224:230])); len(v) > 0 {
if v, err := time.Parse("060102", v); err == nil {
g.creationDate = v
}
} |
I fully agree, but in main branch there's a double prefixing between caller and callee, so let's leave a single prefixing, here: |
|
|
Ah, forgot about tests. Well, ignoring all GSI parsing errors doesn't seem such a good idea, some values are used afterwards. |
|
Thanks 👍 You just forgot to revert error prefixes in |
Encountered the following error message on a bad STL file:
astisub: building gsi block failed: astisub: atoi of � failed: strconv.Atoi: parsing "\x01": invalid syntaxDecided to replace the second occurence of "astisub" with the name of the target variable, in every place with int or date parsing, so this PR will output:
astisub: building gsi block failed: totalNumberOfDisks: atoi of failed: strconv.Atoi: parsing "\x01": invalid syntaxwhich makes it easier to pinpoint the bad location in the STL file.
(one could also wonder if it would be worth it to replace the %s of "atoi of %s failed" with a %q, in case of a non-printable string like in this example ...)
Bonus, line 835, removed the "astisub: " prefix which is redundant with the message line 206 in ReadFromSTL().