Closed Bug 1334488 Opened 9 years ago Closed 9 years ago

[manifestparser] Improve error message when ini parser fails to find a new section

Categories

(Testing :: Mozbase, defect)

defect
Not set
normal

Tracking

(firefox54 fixed)

RESOLVED FIXED
mozilla54
Tracking Status
firefox54 --- fixed

People

(Reporter: ahal, Assigned: ahal)

References

Details

Attachments

(1 file)

This is a spin off from bug 1333564 comment 17. Currently we print "No sections found" if an unexpected token is found at the start of a manifest: https://dxr.mozilla.org/mozilla-central/rev/1e0e193b0812f68a12fbd69198552af62347af1e/testing/mozbase/manifestparser/manifestparser/ini.py#73 Instead it should probably say something like: "Expected a comment or section, instead found ';'." While we're doing this we also might as well create a new IniParseError exception or something similar.
Assignee: nobody → ahalberstadt
Status: NEW → ASSIGNED
Comment on attachment 8831149 [details] Bug 1334488 - [manifestparser] Improve error message when using an invalid comment character at the start of a manifest, https://reviewboard.mozilla.org/r/107774/#review108934 ::: testing/mozbase/manifestparser/manifestparser/ini.py:105 (Diff revision 1) > continue > > # if there aren't any sections yet, something bad happen > if not section_names: > - raise Exception("Error parsing manifest file '%s', line %s: No sections found" % > - (getattr(fp, 'name', 'unknown'), linenum)) > + raise IniParseError(fp, linenum, "Expected a comment or section, " > + "instead found '{}'".format(stripped[0])) why stripped[0], could we instead print stripped in full? ::: testing/mozbase/manifestparser/manifestparser/ini.py:129 (Diff revision 1) > if line[0].isspace() and key: > value = '%s%s%s' % (value, os.linesep, stripped) > current_section[key] = value > else: > # something bad happened! > - raise Exception("Error parsing manifest file '%s', line %s" % > + raise IniParseError(fp, linenum, "Unexpected token '{}'".format(stripped[0])) why stripped[0], could we instead print stripped in full?
Attachment #8831149 - Flags: review?(jmaher) → review-
Comment on attachment 8831149 [details] Bug 1334488 - [manifestparser] Improve error message when using an invalid comment character at the start of a manifest, https://reviewboard.mozilla.org/r/107774/#review108934 > why stripped[0], could we instead print stripped in full? Good point!
Comment on attachment 8831149 [details] Bug 1334488 - [manifestparser] Improve error message when using an invalid comment character at the start of a manifest, https://reviewboard.mozilla.org/r/107774/#review108948 thanks!
Attachment #8831149 - Flags: review?(jmaher) → review+
Pushed by ahalberstadt@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a15be64c8440 [manifestparser] Improve error message when using an invalid comment character at the start of a manifest, r=jmaher
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: