Skip to content

Have a voice for developers: what should and should not be logged. #38

@johnjbarton

Description

@johnjbarton

This is a meta request inspired by a bug report to Chrome about SVG parsing errors.

https://bugs.chromium.org/p/chromium/issues/detail?id=601493#c3

A program like

<script>
(function () {
  try {
    var svgns = "http://www.w3.org/2000/svg";
    var shape = document.createElementNS(svgns, "circle");
    shape.setAttributeNS(null, "r",  "foo");
    console.log('No exception was thrown');
  } catch(ex) {
    console.error(ex.stack || ex);
  }
})();
</script>

Puts this in the console:

 'Error: <circle> attribute r: Expected length, "foo".'

Developers focus a lot of attention on the browser console. It is their
primary UI to develop web pages. As we are trying to use the Web to create
useful content, we request that the browser also try to be useful in its
output to the console for developers.

Sending "Error" to the console as a logging message is not useful. We
don't have any mechanism for routing such messages. We can't log them when
users find them; we can't check for them in unit tests; we can't prevent
them when we know the errors are harmless. There is an established and
effective solution for errors: throw JS exceptions or route the errors
through window.onerror.

Trying to report these issues to browsers is hopeless. I hope this group can have a stronger voice for developers. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions