Add line number + code to SVG parsing error message




7 years ago
7 years ago


(Reporter: virtue, Unassigned)


Firefox Tracking Flags

(Not tracked)




7 years ago
User Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.106 Safari/535.2

Steps to reproduce:

When firefox encounters an error in a SVG file, or when a bad attribute value is assigned to an SVG element by javascript, a very vague error message is shown, something like:

    Unexpected value NaN parsing y attribute.

In a complex document (or with multiple documents), there's almost no way to track down where this error is happening.

Expected results:

Ideally, the error message would look more like this for javascript:

    Unexpected value NaN parsing y attribute.
    Line 103:    svgElement.setAttribute('x', some_bad_js_variable);

Or this for normal SVG markup:

    Unexpected value "abc" parsing y attribute.
    Line 103:    <circle cx="abc" cy="123" />
This suggestion is very difficult to implement. The code that produces the error message is common to javascript and markup and doesn't know which one is calling it to ask for the line number.

I could add the element name to the error message e.g.

Unexpected value NaN parsing y attribute on element z

If that's acceptable.
Duplicate of this bug: 737094
You need to log in before you can comment on or make changes to this bug.