The default bug view has changed. See this FAQ.

WebIDLError should take a list of locations

RESOLVED FIXED in mozilla16

Status

()

Core
DOM
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: bz, Assigned: bz)

Tracking

(Blocks: 1 bug)

unspecified
mozilla16
x86
Mac OS X
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

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...
Created attachment 636387 [details] [diff] [review]
Make the WebIDLError constructor take a list of locations.
Attachment #636387 - Flags: review?(justin.lebar+bug)
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
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.