Closed Bug 767546 Opened 12 years ago Closed 12 years ago

WebIDLError should take a list of locations

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla16

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Right now we pass one location directly and the rest in a list.  That's kinda hacky; we should just pass a list.

Will wait for Peter to land unions before doing this...
Whiteboard: [need review]
> class WebIDLError(Exception):
>-    def __init__(self, message, location, warning=False, extraLocations=[]):
>+    def __init__(self, message, locations, warning=False):
>         self.message = message
>-        self.location = location
>+        self.locations = [str(loc) for loc in locations]
>         self.warning = warning
>-        self.extraLocations = [str(loc) for loc in extraLocations]

Hm, this may have been a good opportunity to use Python's *arg syntax:

  def __init__(self, message, *locations):

There may be a way to shim the warning=False arg into there (although I don't see how that would work), but we could also have WebIDLError and WebIDLWarning as separate classes.

OTOH the list is totally clear, and I don't think we have to mess with this further unless you want to.

> class BuiltinLocation(object):
>     def __init__(self, text):
>-        self.msg = text
>+        self.msg = text + "\n"

To make sure I understood why you did this: You want BuiltinLocation to have an extra blank line to match Location's _pointerline marker?
Attachment #636387 - Flags: review?(justin.lebar+bug) → review+
> You want BuiltinLocation to have an extra blank line to match Location's _pointerline
> marker?

Hmm.  I added it because stuff was ending up on the same line to my eyes, but yes, looks like that's the main effect.
https://hg.mozilla.org/integration/mozilla-inbound/rev/f44dce601af6
Flags: in-testsuite-
Whiteboard: [need review]
Target Milestone: --- → mozilla16
https://hg.mozilla.org/mozilla-central/rev/f44dce601af6
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: